mozilla

Revision 90404 of NPSavedData

  • Revision slug: NPSavedData
  • Revision title: NPSavedData
  • Revision id: 90404
  • Created:
  • Creator: jgriffin
  • Is current revision? No
  • Comment 2 words removed

Revision Content

{{ Np-plugin-api() }}

Summary

Block of instance information saved after the plug-in is deleted; can be returned to the plug-in.

Syntax

typedef struct _NPSavedData
{
    int32  len;
    void*  buf;
} NPSavedData;

Fields

The data structure has the following fields:

len
Length in bytes of the buffer pointed to by buf; set by the plug-in.
buf
Pointer to a memory buffer allocated by the plug-in with NPN_MemAlloc. Can be any reasonable size; its contents are private to the plug-in and are not modified by the browser.

Description

The NPSavedData object contains a block of per-instance information that Communicator saves after the instance is deleted. This information can be returned to another instance of the same plug-in if the user returns to the web page that contains it.

You can use the plug-in's NPP_Destroy function to allocate an NPSavedData object using the NPN_MemAlloc function, fill in the fields, and return it to the browser as an output parameter. See Instance Destruction for a code example that shows how to use NPSavedData.

If the user revisits a web page that contains a plug-in, the browser returns the NPSavedData to the new instance of the plug-in in a call to NPP_New. After this, the plug-in is responsible for keeping or deleting the objects as necessary.

See Also

NPP_New, NPP_Destroy

Revision Source

<p>{{ Np-plugin-api() }}</p>
<h3 name="Summary">Summary</h3>
<p>Block of instance information saved after the plug-in is deleted; can be returned to the plug-in.</p>
<h3 name="Syntax">Syntax</h3>
<pre>typedef struct _NPSavedData
{
    int32  len;
    void*  buf;
} NPSavedData;
</pre>
<h3 name="Fields">Fields</h3>
<p>The data structure has the following fields:</p>
<dl> <dt>len</dt> <dd>Length in bytes of the buffer pointed to by buf; set by the plug-in.</dd>
</dl>
<dl> <dt>buf</dt> <dd>Pointer to a memory buffer allocated by the plug-in with <a href="/en/NPN_MemAlloc" title="en/NPN_MemAlloc">NPN_MemAlloc</a>. Can be any reasonable size; its contents are private to the plug-in and are not modified by the browser.</dd>
</dl>
<h3 name="Description">Description</h3>
<p>The <code>NPSavedData</code> object contains a block of per-instance information that Communicator saves after the instance is deleted. This information can be returned to another instance of the same plug-in if the user returns to the web page that contains it.</p>
<p>You can use the plug-in's <a href="/en/NPP_Destroy" title="en/NPP_Destroy">NPP_Destroy</a> function to allocate an <code>NPSavedData</code> object using the NPN_MemAlloc function, fill in the fields, and return it to the browser as an output parameter. See <a class="internal" href="/en/Gecko_Plugin_API_Reference/Initialization_and_Destruction#Instance_Destruction" title="en/Gecko Plugin API Reference/Initialization and Destruction#Instance Destruction">Instance Destruction</a> for a code example that shows how to use <code>NPSavedData</code>.</p>
<p>If the user revisits a web page that contains a plug-in, the browser returns the <code>NPSavedData</code> to the new instance of the plug-in in a call to <a href="/en/NPP_New" title="en/NPP_New">NPP_New</a>. After this, the plug-in is responsible for keeping or deleting the objects as necessary.</p>
<h3 name="See_Also">See Also</h3>
<p><a href="/en/NPP_New" title="en/NPP_New">NPP_New</a>, <a href="/en/NPP_Destroy" title="en/NPP_Destroy">NPP_Destroy</a></p>
Revert to this revision