Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / Storage.webidl
bloba9e03939294fdcde7be607f4c880a862611360e9
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * http://www.whatwg.org/html/#the-storage-interface
9 * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
10 * Opera Software ASA. You are granted a license to use, reproduce
11 * and create derivative works of this document.
14 [Exposed=Window]
15 interface Storage {
16   [Throws, NeedsSubjectPrincipal]
17   readonly attribute unsigned long length;
19   [Throws, NeedsSubjectPrincipal]
20   DOMString? key(unsigned long index);
22   [Throws, NeedsSubjectPrincipal]
23   getter DOMString? getItem(DOMString key);
25   [Throws, NeedsSubjectPrincipal]
26   setter undefined setItem(DOMString key, DOMString value);
28   [Throws, NeedsSubjectPrincipal]
29   deleter undefined removeItem(DOMString key);
31   [Throws, NeedsSubjectPrincipal]
32   undefined clear();
35 /**
36  * Testing methods that exist only for the benefit of automated glass-box
37  * testing.  Will never be exposed to content at large and unlikely to be useful
38  * in a WebDriver context.
39  */
40 partial interface Storage {
41   /**
42    * Does a security-check and ensures the underlying database has been opened
43    * without actually calling any database methods.  (Read-only methods will
44    * have a similar effect but also impact the state of the snapshot.)
45    */
46   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
47   undefined open();
49   /**
50    * Automatically ends any explicit snapshot and drops the reference to the
51    * underlying database, but does not otherwise perturb the database.
52    */
53   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
54   undefined close();
56   /**
57    * Ensures the database has been opened and initiates an explicit snapshot.
58    * Snapshots are normally automatically ended and checkpointed back to the
59    * parent, but explicitly opened snapshots must be explicitly ended via
60    * `endExplicitSnapshot` or `close`.
61    */
62   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
63   undefined beginExplicitSnapshot();
65   /**
66    * Checkpoints the explicitly begun snapshot. This is only useful for testing
67    * of snapshot re-using when multiple checkpoints are involved. There's no
68    * need to call this before `endExplicitSnapshot` because it checkpoints the
69    * snapshot before it's ended.
70    */
71   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
72   undefined checkpointExplicitSnapshot();
74   /**
75    * Ends the explicitly begun snapshot and retains the underlying database.
76    * Compare with `close` which also drops the reference to the database.
77    */
78   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
79   undefined endExplicitSnapshot();
81   /**
82    * Returns true if the underlying database has been opened, the database is
83    * not being closed and it has a snapshot (initialized implicitly or
84    * explicitly).
85    */
86   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
87   readonly attribute boolean hasSnapshot;
89   /**
90    * Returns snapshot usage.
91    *
92    * @throws NS_ERROR_NOT_AVAILABLE if the underlying database hasn't been
93    *         opened or the database is being closed or it doesn't have a
94    *         snapshot.
95    */
96   [Throws, NeedsSubjectPrincipal, Pref="dom.storage.testing"]
97   readonly attribute long long snapshotUsage;