2007-10-04 10:05:32 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-10-04 10:05:32 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2009-05-16 17:59:30 +04:00
|
|
|
interface nsIDOMStorage;
|
2009-03-19 02:43:45 +03:00
|
|
|
interface nsIPrincipal;
|
2016-01-30 20:05:36 +03:00
|
|
|
interface mozIDOMWindow;
|
2009-03-19 02:43:45 +03:00
|
|
|
|
2013-04-15 16:38:48 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
[scriptable, uuid(a20c742e-3ed1-44fb-b897-4080a75b1662)]
|
2007-10-04 10:05:32 +04:00
|
|
|
interface nsIDOMStorageManager : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2013-04-15 16:38:48 +04:00
|
|
|
* This starts async preloading of a storage cache for scope
|
|
|
|
* defined by the principal.
|
|
|
|
*/
|
|
|
|
void precacheStorage(in nsIPrincipal aPrincipal);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2014-07-23 09:07:12 +04:00
|
|
|
* @param aWindow
|
|
|
|
* The parent window.
|
2013-04-15 16:38:48 +04:00
|
|
|
* @param aPrincipal
|
|
|
|
* Principal to bound storage to.
|
|
|
|
* @param aDocumentURI
|
|
|
|
* URL of the demanding document, used for DOM storage event only.
|
|
|
|
* @param aPrivate
|
|
|
|
* Whether the demanding document is running in Private Browsing mode or not.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
nsIDOMStorage createStorage(in mozIDOMWindow aWindow,
|
2014-07-23 09:07:12 +04:00
|
|
|
in nsIPrincipal aPrincipal,
|
2016-06-29 15:01:00 +03:00
|
|
|
in DOMString aDocumentURI);
|
2013-04-15 16:38:48 +04:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2014-07-23 09:07:12 +04:00
|
|
|
* @param aWindow
|
|
|
|
* The parent window.
|
2013-04-15 16:38:48 +04:00
|
|
|
* @param aPrincipal
|
|
|
|
* Principal to bound storage to.
|
|
|
|
* @param aPrivate
|
|
|
|
* Whether the demanding document is running in Private Browsing mode or not.
|
|
|
|
*/
|
2016-01-30 20:05:36 +03:00
|
|
|
nsIDOMStorage getStorage(in mozIDOMWindow aWindow,
|
2016-06-29 15:01:00 +03:00
|
|
|
in nsIPrincipal aPrincipal);
|
2013-04-15 16:38:48 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clones given storage into this storage manager.
|
2007-10-04 10:05:32 +04:00
|
|
|
*
|
2013-04-15 16:38:48 +04:00
|
|
|
* @param 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.
|
2007-10-04 10:05:32 +04:00
|
|
|
*/
|
2013-04-15 16:38:48 +04:00
|
|
|
void cloneStorage(in nsIDOMStorage aStorageToCloneFrom);
|
2008-01-23 07:06:36 +03:00
|
|
|
|
2009-03-19 02:43:45 +03:00
|
|
|
/**
|
2013-04-15 16:38:48 +04:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @param aPrincipal
|
|
|
|
* Principal to check the storage against.
|
|
|
|
* @param aStorage
|
|
|
|
* The storage object to examine.
|
|
|
|
*
|
|
|
|
* @result
|
|
|
|
* true when the storage object is bound with the principal and is managed
|
|
|
|
* by this storage manager.
|
|
|
|
* false otherwise
|
|
|
|
*/
|
|
|
|
bool checkStorage(in nsIPrincipal aPrincipal,
|
|
|
|
in nsIDOMStorage aStorage);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*
|
2009-03-19 02:43:45 +03:00
|
|
|
* Returns instance of localStorage object for aURI's origin.
|
|
|
|
* This method ensures there is always only a single instance
|
|
|
|
* for a single origin.
|
2013-04-15 16:38:48 +04:00
|
|
|
*
|
|
|
|
* Currently just forwards to the createStorage method of this
|
|
|
|
* interface.
|
|
|
|
*
|
|
|
|
* Extension developers are strongly encouraged to use getStorage
|
|
|
|
* or createStorage method instead.
|
2009-03-19 02:43:45 +03:00
|
|
|
*/
|
2010-01-28 17:53:53 +03:00
|
|
|
nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal,
|
2016-06-29 15:01:00 +03:00
|
|
|
in DOMString aDocumentURI);
|
2007-10-04 10:05:32 +04:00
|
|
|
};
|