Confirmed users, Bureaucrats and Sysops emeriti
1,680
edits
(One intermediate revision by the same user not shown) | |||
Line 29: | Line 29: | ||
* <code>flags</code>: | * <code>flags</code>: | ||
** Future use, no flags defined now. | ** Future use, no flags defined now. | ||
* <code>pMemBlock</code>: The starting address of the memory | * <code>pMemBlock</code>: The starting address of the memory block. | ||
* <code>sizeOfMemBlock</code>: The size of the memory block in bytes | * <code>sizeOfMemBlock</code>: The size of the memory block in bytes | ||
Line 38: | Line 38: | ||
* <code>NPERR_NO_ERROR</code>: If successful | * <code>NPERR_NO_ERROR</code>: If successful | ||
If the API is called with | Registered buffers must contain textual UTF8/ASCII data which is <code>NULL</code> terminated. Non-textual data can be encoded as text before it is placed in a registered buffer. | ||
The browser will not read a registered buffer upon registration, thus there is no need to re-register after changing the contents of a registered buffer. The buffer will only be read from a crash handler. Registering memory address <code>NULL</code> (zero) will not be allowed, to avoid the issue in which a plugin might register the result of a <code>malloc</code> call without a <code>NULL</code> check. | |||
If the API is called with a key that has already been registered, the new registration will replace the old one. Plugins can attempt to register multiple buffers. | |||
Calling <code>NPN_GetValue</code> with new key <code>NPNVmaxCrashMemoryBlockSize</code> 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. | Calling <code>NPN_GetValue</code> with new key <code>NPNVmaxCrashMemoryBlockSize</code> 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. |