NPAPI:ClearSiteData: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(71 intermediate revisions by 6 users not shown)
Line 1: Line 1:
= Status =
= Status =


(work in progress)
Accepted, ready for implementation.


= Problem Summary =
= Contributors =


In short: let the UA's "clear cookies" function also clear Flash's local storage.
* Last modified: January 6, 2011
* Authors: Julian Reschke (greenbytes), Dan Witte (Mozilla), Bernhard Bauer (Chromium), Rajesh Gwalani (Adobe), Josh Aas (Mozilla), Maciej Stachowiak (Apple)


More precisely: delegate calls to the UAs "clear privacy information" to plugins, allowing them to clean up their locally stored data as well.
= Overview =


== Overview of current UIs ==
Allows browsers to discover and clear plugin private data.


{|
= Specification =
! Type || Firefox || IE || Opera || Safari
|-
! Browsing History
| yes || yes || yes || yes
|-
! Download History
| yes || yes || yes || yes
|-
! Form History
| yes || yes || ? || yes
|-
! Search History
| yes || ? || ? || ?
|-
! Cookies
| yes || yes || temporary/all || yes
|-
! Cache
| yes || yes || yes || yes
|-
! Active Logins
| yes || yes || "password manager" || yes
|-
! Site Preferences
| yes || ? || ? || ?
|}


In addition, IE has "InPrivate Filtering Data" (what is this?)
== Definition of domain ==


In addition, Opera has "delete password protected pages and data" and "boomkark visited times".
The return value of NPP_GetSitesWithData and the 'site' argument to NPP_ClearSiteData must be domains only (not complete URIs or IRIs). For ASCII domains, they must be lowercase; in the case of internationalized domains, they must be NFKC-encoded (normalized) UTF-8. No other encoding is allowed. IP address literals must be enclosed in square brackets '[]'. This is in accordance with RFC 3987, Internationalized Resource Identifiers (IRIs).


In addition, Safari has "webpage preview images", "website icons" and "top sites"
== Discovering Data ==


{|
The following method will allow browsers to discover which sites a plugin has data for. Note that plugins (but no instances) must be initialized and function tables retrieved in order to call this method.
! Parameters || Firefox || IE || Opera
|-
! Time Range
| yes || no || no || no
|}


= Existing Discussion and Documentation =
<pre>
char** NPP_GetSitesWithData(void);
</pre>


= API Requirements =
This function returns a <code>NULL</code>-terminated list of sites with data. Each site string is a domain as specified above under 'Definition of domain'. Memory for the array and the site strings must be allocated with <code>NPN_MemAlloc</code> and the browser will be responsible for freeing the memory with <code>NPN_MemFree</code>.


= Current Proposal =
== Clearing Data ==
 
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(
  const char* site,      // site for which to clear data
  uint64_t flags,        // what type of data to clear
  uint64_t maxAge        // max. age of information in seconds
);
</pre>
 
* The <code>site</code> argument is interpreted as follows:
** 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>, argument is a site string from the discovery API (an exact copy or the original). See above under 'Definition of domain' for the required form of the string. The browser is responsible for allocating and freeing the memory used for this argument. The plugin must copy the string in order to retain it outside the scope of the call.
* 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 private data */
#define NP_CLEAR_CACHE  1 << 0 /* Clear cached data which can simply be
                                  retrieved again as requested. To be used
                                  out of concern for space and not necessarily
                                  privacy. */
/* More flags may be defined later, this spec will be updated. */
</pre>
* 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 <code>NPError</code> values will be available for return from <code>NPP_ClearSiteData</code>:
 
<pre>
// can't clear by time range
#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
// malformed 'site' string
#define NPERR_MALFORMED_SITE (NPERR_BASE + 15)
</pre>
 
For any other type of error the plugin must return <code>NPERR_GENERIC_ERROR</code>.
 
If site data is in use by an instance of the plugin when <code>NPP_ClearSiteData</code> is called then it is up to the plugin to do the right thing.
 
= Notes =
 
Notes for this specification are [[NPAPI:ClearPrivateDataNotes|here]].

Latest revision as of 20:57, 6 January 2011

Status

Accepted, ready for implementation.

Contributors

  • Last modified: January 6, 2011
  • Authors: Julian Reschke (greenbytes), Dan Witte (Mozilla), Bernhard Bauer (Chromium), Rajesh Gwalani (Adobe), Josh Aas (Mozilla), Maciej Stachowiak (Apple)

Overview

Allows browsers to discover and clear plugin private data.

Specification

Definition of domain

The return value of NPP_GetSitesWithData and the 'site' argument to NPP_ClearSiteData must be domains only (not complete URIs or IRIs). For ASCII domains, they must be lowercase; in the case of internationalized domains, they must be NFKC-encoded (normalized) UTF-8. No other encoding is allowed. IP address literals must be enclosed in square brackets '[]'. This is in accordance with RFC 3987, Internationalized Resource Identifiers (IRIs).

Discovering Data

The following method will allow browsers to discover which sites a plugin has data for. Note that plugins (but no instances) must be initialized and function tables retrieved in order to call this method.

char** NPP_GetSitesWithData(void);

This function returns a NULL-terminated list of sites with data. Each site string is a domain as specified above under 'Definition of domain'. Memory for the array and the site strings must be allocated with NPN_MemAlloc and the browser will be responsible for freeing the memory with NPN_MemFree.

Clearing Data

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.

NPError NPP_ClearSiteData(
   const char* site,       // site for which to clear data
   uint64_t flags,         // what type of data to clear
   uint64_t maxAge         // max. age of information in seconds
);
  • The site argument is interpreted as follows:
    • If NULL, all site-specific data and more generic data on browsing history (for instance, number of sites visited) should be cleared.
    • If !NULL, argument is a site string from the discovery API (an exact copy or the original). See above under 'Definition of domain' for the required form of the string. The browser is responsible for allocating and freeing the memory used for this argument. The plugin must copy the string in order to retain it outside the scope of the call.
  • The flags argument is a bit mask representing the type(s) of data to clear.
#define NP_CLEAR_ALL     0      /* Clear all private data */
#define NP_CLEAR_CACHE   1 << 0 /* Clear cached data which can simply be
                                   retrieved again as requested. To be used
                                   out of concern for space and not necessarily
                                   privacy. */
/* More flags may be defined later, this spec will be updated. */
  • The maxAge argument is the maximum age in seconds of data to clear, inclusive. If maxAge is 0, no data is cleared. If maxAge is the maximum unsigned 64-bit integer, all data is cleared.

The following new NPError values will be available for return from NPP_ClearSiteData:

// can't clear by time range
#define NPERR_TIME_RANGE_NOT_SUPPORTED (NPERR_BASE + 14)
// malformed 'site' string
#define NPERR_MALFORMED_SITE (NPERR_BASE + 15)

For any other type of error the plugin must return NPERR_GENERIC_ERROR.

If site data is in use by an instance of the plugin when NPP_ClearSiteData is called then it is up to the plugin to do the right thing.

Notes

Notes for this specification are here.