nsIDOMStorageManager

General purpose interface that has two implementations, for localStorage
resp. sessionStorage with “@mozilla.org/dom/localStorage-manager;1” resp.
“@mozilla.org/dom/sessionStorage-manager;1” contract IDs.

Methods

precacheStorage(aPrincipal)

This starts async preloading of a storage cache for scope
defined by the principal.

createStorage(aWindow, aPrincipal, aDocumentURI, aPrivate)

Returns instance of DOM storage object for given principal.
A new object is always returned and it is ensured there is
a storage for the scope created.

Parameters

aWindow The parent window.
aPrincipal Principal to bound storage to.
aDocumentURI URL of the demanding document, used for DOM storage event only.
aPrivate Whether the demanding document is running in Private Browsing mode or not.

getStorage(aWindow, aPrincipal, aPrivate)

Returns instance of DOM storage object for given principal.
If there is no storage managed for the scope, then null is returned and
no object is created. Otherwise, an object (new) for the existing storage
scope is returned.

Parameters

aWindow The parent window.
aPrincipal Principal to bound storage to.
aPrivate Whether the demanding document is running in Private Browsing mode or not.

cloneStorage(aStorageToCloneFrom)

Clones given storage into this storage manager.

Parameters

aStorageToCloneFrom The storage to copy all items from into this manager. Manager will then return a new and independent object that contains snapshot of data from the moment this method was called. Modification to this new object will not affect the original storage content we cloned from and vice versa.

checkStorage(aPrincipal, aStorage)

Returns true if the storage belongs to the given principal and is managed
(i.e. has been created and is cached) by this storage manager.

@result
true when the storage object is bound with the principal and is managed
by this storage manager.
false otherwise

Parameters

aPrincipal Principal to check the storage against.
aStorage The storage object to examine.

getLocalStorageForPrincipal(aPrincipal, aDocumentURI, aPrivate)

@deprecated

Returns instance of localStorage object for aURI’s origin.
This method ensures there is always only a single instance
for a single origin.

Currently just forwards to the createStorage method of this
interface.

Extension developers are strongly encouraged to use getStorage
or createStorage method instead.