NPAPI:ErrorReporting: Difference between revisions

Line 18: Line 18:
= Current Proposal =
= Current Proposal =


The current proposal is to add two new  methods for registering and unregistering memory  
The current proposal adds two new  methods for registering and unregistering blocks of memory.
blocks


<pre>
<pre>
NPError NPN_ErrorReportingRegisterMemoryBlock(
NPError NPN_ErrorReportingRegisterMemoryBlock(const char* key,  
const char* key,  
                                              unit flags,
unit flags,
                                              void* pMemBlock,  
void* pMemBlock,  
                                              size_t sizeOfMemBlock);
size_t sizeOfMemBlock);
</pre>


Parameters:
Parameters:
* key – unique string identifying the memory block
* flags - NPMEM_CHARACTER_DATA - the data is character data which can be
presented as UTF8/ASCII data
NPMEM_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 block
* sizeOfMemBlock – The size of the memory block in bytes


Return Value:
* <code>key</code>: unique string identifying the memory block
* NPERR_OUT_OF_MEMORY_ERROR - If the memory size exceeds the maximum size allowed
* <code>flags</code>:
* NPERR_INVALID_PARAM - If the registration fails
** <code>NPMEM_CHARACTER_DATA</code>: the data is character data which can be presented as UTF8/ASCII data
* NPERR_NO_ERROR - If successful
** <code>NPMEM_NOT_PERSONAL</code>: the data is guaranteed to not contain any personally identifying information such as URLs, cookie data, etc
</pre>
* <code>pMemBlock</code>: The starting address of the memory block
* <code>sizeOfMemBlock</code>: The size of the memory block in bytes
 
Return value:
 
* <code>NPERR_OUT_OF_MEMORY_ERROR</code>: If the memory size exceeds the maximum size allowed
* <code>NPERR_INVALID_PARAM</code>: If the registration fails
* <code>NPERR_NO_ERROR</code>: 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.


* If the API is called with same key that was registered earlier, then API call with
Calling <code>NPN_GetValue</code> with new key <code>NPNVmaxCrashMemoryBlockSize</code> can be used to get the maximum block size that could be registered.
succeed and call will override the old pointer and length values.
* Plugin is allowed to register as many memory blocks as it wants
* NPN_GetValue with key "NPNVmaxCrashMemoryBlockSize" can be used to get the maximum
block size that could be registered


<pre>
<pre>
NPError NPN_ErrorReportingUnregisterMemoryBlock(const char* key);  
NPError NPN_ErrorReportingUnregisterMemoryBlock(const char* key);  
</pre>


Parameters:
Parameters:
* key - key value which was used to register the memory block
* key - key value which was used to register the memory block


Return Value:
Return value:
 
* NPERR_INVALID_PARAM  - If un registration fails
* NPERR_INVALID_PARAM  - If un registration fails
* NPERR_NO_ERROR - If un resgitation succeeds
* NPERR_NO_ERROR - If un resgitation succeeds
</pre>


== Open Issues ==
== 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.
* 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.
* Does <code>NPNVmaxCrashMemoryBlockSize</code> give the maximum size for a single registered block or all registered blocks?
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits