NPAPI:ClearSiteData: Difference between revisions

No edit summary
Line 12: Line 12:
*Authors: Julian Reschke (greenbytes), Dan Witte <dwitte@mozilla.com>, Bernhard Bauer <bauerb@chromium.org>, Rajesh Gwalani <rgwalani@adobe.com>
*Authors: Julian Reschke (greenbytes), Dan Witte <dwitte@mozilla.com>, Bernhard Bauer <bauerb@chromium.org>, Rajesh Gwalani <rgwalani@adobe.com>


The current proposal is to add a new method, providing the new functionality:
The following method will allow browsers to request that plugins clear data. Note that plugins (but no instances) must be initialized and function tables retrieved in order to call this method.
<pre>NPError NPP_ClearSiteData(
 
<pre>
NPError NPP_ClearSiteData(
   PRUint64 flags,        // what type of data to clear
   PRUint64 flags,        // what type of data to clear
   const char* origin,    // limit to origin
   const char* origin,    // limit to origin
   PRUInt64 maxAge        // max. age of information in seconds
   PRUInt64 maxAge        // max. age of information in seconds
);</pre>
);
New [https://developer.mozilla.org/en/NPAPI/Constants#Error_Codes NPError codes]:
</pre>
<pre>// can't clear by time range
#define NPERR_TIMERANGE_NOT_SUPPORTED (NPERR_BASE + 14)
// can't clear by origin
#define NPERR_LIMITBYORIGIN_NOT_SUPPORTED (NPERR_BASE + 15)
// malformed 'origin' string
#define NPERR_MALFORMED_ORIGIN (NPERR_BASE + 16)
</pre>  
Semantics:


*<code>flags</code> is a bitset representing which type(s) of data to clear.
* The <code>flags</code> argument is a bit mask representing the type(s) of data to clear.
<pre>#define NP_CLEAR_ALL                0            /* Clear All data */
<pre>
#define NP_CLEAR_ALL                0            /* Clear All data */
#define NP_CLEAR_COOKIES            1 << 0      /* Clear cookies */
#define NP_CLEAR_COOKIES            1 << 0      /* Clear cookies */
#define NP_CLEAR_SITE_PREFS          1 << 1      /* Clear site preferences */
#define NP_CLEAR_SITE_PREFS          1 << 1      /* Clear site preferences */
Line 40: Line 35:
#define NP_CLEAR_PLUGIN_STORAGE      1 << 8      /* Clear plugin local storage */
#define NP_CLEAR_PLUGIN_STORAGE      1 << 8      /* Clear plugin local storage */
</pre>
</pre>
*The <code>origin</code> argument is interpreted as follows:  
* The <code>origin</code> argument is interpreted as follows:  
**if a hostname of the form "foo.com", data in the "foo.com" domain and all subdomains should be cleared. In this form, <code>domain</code> must be a normalized ACE-encoded hostname, lowercased; must not contain a trailing dot; must not contain scheme, port, or other such fields; and must contain at least one embedded dot;
** If a hostname of the form "foo.com", data in the "foo.com" domain and all subdomains should be cleared. In this form domains must be in lowercase normalized ACE-encoded form, they must not contain a trailing dot, must not contain a scheme, port, or other such fields, and must contain at least one embedded dot.
**if an IP address (either IPv4 or IPv6), data for that IP should be cleared;
** If an IP address (either IPv4 or IPv6), data for that IP should be cleared.
**if <code>NULL</code>, all site-specific data and more generic data on browsing history (for instance, number of sites visited) should be cleared.  
** If <code>NULL</code>, all site-specific data and more generic data on browsing history (for instance, number of sites visited) should be cleared.  
*<code>maxAge</code> is the maximum age of data to clear, inclusive, in seconds. If <code>maxAge</code> is <code>0</code>, no data is cleared. If <code>maxAge</code> is the maximum unsigned 64-bit integer, all data is cleared.
* The <code>maxAge</code> argument is the maximum age in seconds of data to clear, inclusive. If <code>maxAge</code> is <code>0</code>, no data is cleared. If <code>maxAge</code> is the maximum unsigned 64-bit integer, all data is cleared.
 
The following new NPError values will be available for return from 'NPP_ClearSiteData'.
 
<pre>
// can't clear by time range
#define NPERR_TIMERANGE_NOT_SUPPORTED (NPERR_BASE + 14)
// can't clear by origin
#define NPERR_LIMITBYORIGIN_NOT_SUPPORTED (NPERR_BASE + 15)
// malformed 'origin' string
#define NPERR_MALFORMED_ORIGIN (NPERR_BASE + 16)
</pre>


= Open Issues  =
= Open Issues  =
Confirmed users, Bureaucrats and Sysops emeriti
1,680

edits