dom/interfaces/storage/nsIDOMStorageManager.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIDOMStorage;
michael@0 9 interface nsIPrincipal;
michael@0 10 interface nsIURI;
michael@0 11
michael@0 12 /**
michael@0 13 * General purpose interface that has two implementations, for localStorage
michael@0 14 * resp. sessionStorage with "@mozilla.org/dom/localStorage-manager;1" resp.
michael@0 15 * "@mozilla.org/dom/sessionStorage-manager;1" contract IDs.
michael@0 16 */
michael@0 17 [scriptable, uuid(96dd7614-fcc8-4745-9a1d-52f44dea8818)]
michael@0 18 interface nsIDOMStorageManager : nsISupports
michael@0 19 {
michael@0 20 /**
michael@0 21 * This starts async preloading of a storage cache for scope
michael@0 22 * defined by the principal.
michael@0 23 *
michael@0 24 * @param aFirstPartyIsolationURI
michael@0 25 * First party URI to bound storage to.
michael@0 26 * @param aPrincipal
michael@0 27 * Principal to bound storage to.
michael@0 28 */
michael@0 29 void precacheStorage(in nsIPrincipal aPrincipal);
michael@0 30 void precacheStorageForFirstParty(in nsIURI aFirstPartyIsolationURI,
michael@0 31 in nsIPrincipal aPrincipal);
michael@0 32
michael@0 33 /**
michael@0 34 * Returns instance of DOM storage object for given principal.
michael@0 35 * A new object is always returned and it is ensured there is
michael@0 36 * a storage for the scope created.
michael@0 37 *
michael@0 38 * @param aFirstPartyIsolationURI
michael@0 39 * First party URI to bound storage to.
michael@0 40 * @param aPrincipal
michael@0 41 * Principal to bound storage to.
michael@0 42 * @param aDocumentURI
michael@0 43 * URL of the demanding document, used for DOM storage event only.
michael@0 44 * @param aPrivate
michael@0 45 * Whether the demanding document is running in Private Browsing mode or not.
michael@0 46 */
michael@0 47 nsIDOMStorage createStorage(in nsIPrincipal aPrincipal,
michael@0 48 in DOMString aDocumentURI,
michael@0 49 [optional] in bool aPrivate);
michael@0 50 nsIDOMStorage createStorageForFirstParty(in nsIURI aFirstPartyIsolationURI,
michael@0 51 in nsIPrincipal aPrincipal,
michael@0 52 in DOMString aDocumentURI,
michael@0 53 [optional] in bool aPrivate);
michael@0 54 /**
michael@0 55 * Returns instance of DOM storage object for given principal.
michael@0 56 * If there is no storage managed for the scope, then null is returned and
michael@0 57 * no object is created. Otherwise, an object (new) for the existing storage
michael@0 58 * scope is returned.
michael@0 59 *
michael@0 60 * @param aPrincipal
michael@0 61 * Principal to bound storage to.
michael@0 62 * @param aPrivate
michael@0 63 * Whether the demanding document is running in Private Browsing mode or not.
michael@0 64 */
michael@0 65 nsIDOMStorage getStorage(in nsIPrincipal aPrincipal,
michael@0 66 [optional] in bool aPrivate);
michael@0 67 nsIDOMStorage getStorageForFirstParty(in nsIURI aFirstPartyIsolationURI,
michael@0 68 in nsIPrincipal aPrincipal,
michael@0 69 [optional] in bool aPrivate);
michael@0 70
michael@0 71 /**
michael@0 72 * Clones given storage into this storage manager.
michael@0 73 *
michael@0 74 * @param aStorageToCloneFrom
michael@0 75 * The storage to copy all items from into this manager. Manager will then
michael@0 76 * return a new and independent object that contains snapshot of data from
michael@0 77 * the moment this method was called. Modification to this new object will
michael@0 78 * not affect the original storage content we cloned from and vice versa.
michael@0 79 */
michael@0 80 void cloneStorage(in nsIDOMStorage aStorageToCloneFrom);
michael@0 81
michael@0 82 /**
michael@0 83 * Returns true if the storage belongs to the given principal and is managed
michael@0 84 * (i.e. has been created and is cached) by this storage manager.
michael@0 85 *
michael@0 86 * @param aFirstPartyIsolationURI
michael@0 87 * First party URI to check the storage against.
michael@0 88 * @param aPrincipal
michael@0 89 * Principal to check the storage against.
michael@0 90 * @param aStorage
michael@0 91 * The storage object to examine.
michael@0 92 *
michael@0 93 * @result
michael@0 94 * true when the storage object is bound with the principal and is managed
michael@0 95 * by this storage manager.
michael@0 96 * false otherwise
michael@0 97 */
michael@0 98 bool checkStorage(in nsIPrincipal aPrincipal,
michael@0 99 in nsIDOMStorage aStorage);
michael@0 100 bool checkStorageForFirstParty(in nsIURI aFirstPartyIsolationURI,
michael@0 101 in nsIPrincipal aPrincipal,
michael@0 102 in nsIDOMStorage aStorage);
michael@0 103
michael@0 104 /**
michael@0 105 * @deprecated
michael@0 106 *
michael@0 107 * Returns instance of localStorage object for aURI's origin.
michael@0 108 * This method ensures there is always only a single instance
michael@0 109 * for a single origin.
michael@0 110 *
michael@0 111 * Currently just forwards to the createStorage method of this
michael@0 112 * interface.
michael@0 113 *
michael@0 114 * Extension developers are strongly encouraged to use getStorage
michael@0 115 * or createStorage method instead.
michael@0 116 */
michael@0 117 nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal,
michael@0 118 in DOMString aDocumentURI,
michael@0 119 [optional] in bool aPrivate);
michael@0 120 };

mercurial