NPAPI:ErrorReporting
Status
Under Consideration
Contributors
- Last modified: April 14, 2011
- Authors: Sandeep Akula (Adobe Systems), Vinod Menon (Adobe Systems)
- Contributors: Josh Aas (Mozilla Corporation)
Problem Summary
Currently there are no mechanisms available for browser plug-ins to add plug-in specific data into browser-generated crash reports. Additional information added by browser plug-ins will facilitate easier and faster troubleshooting of plug-ins. This necessitates browsers to provide interfaces through which plug-in can indicate to the browser, plug-in specific data that it needs browser to capture as part of crash dumps in case a crash occurs. The NPAPI doesn’t have any interfaces to send plug-in’s custom data along with crash dump when an unhandled exception occurs in the plug-in. To support this we are proposing an extension to the current API.
Current Proposal
Two new functions for registering and unregistering blocks of memory are added.
NPError NPN_ErrorReportingRegisterMemoryBlock(const char* key, uint32_t flags, void* pMemBlock, size_t sizeOfMemBlock);
Parameters:
key
: unique string identifying the memory blockflags
:NPMEM_CHARACTER_DATA
: the data is character data which can be presented as UTF8/ASCII dataNPMEM_NOT_PERSONAL
: the data is guaranteed to not contain any personally identifying information such as URLs, cookie data, etc
pMemBlock
: The starting address of the memory blocksizeOfMemBlock
: The size of the memory block in bytes
Return value:
NPERR_OUT_OF_MEMORY_ERROR
: If the memory size exceeds the maximum size allowedNPERR_INVALID_PARAM
: If the registration failsNPERR_NO_ERROR
: If successful
If the API is called with same key that was registered earlier, then API call with succeed and call will override the old pointer and length values. The plugin can attempt to register multiple memory blocks.
Calling NPN_GetValue
with new key NPNVmaxCrashMemoryBlockSize
can be used to get the maximum amount of memory available for a plugin's block registration. This is not a per-block or per-instance limit, it is a per-plugin limit.
NPError NPN_ErrorReportingUnregisterMemoryBlock(const char* key);
Parameters:
key
: key value which was used to register the memory block
Return value:
NPERR_INVALID_PARAM
: invalid memory keyNPERR_GENERIC_ERROR
: any generic errorNPERR_NO_ERROR
: memory successfully unregistered
Open Issues
- We need to check with browser vendor crash reporting teams to make sure we can handle arbitrary blocks of memory. Right now, for example, I think Mozilla is only set up to handle string annotations and I'm not sure what additional challenges random memory will pose.