Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "domstubs.idl"
8 /**
9 * Interface for client side storage. See
10 * http://www.whatwg.org/specs/web-apps/current-work/multipage/structured.html#storage0
11 * for more information.
12 *
13 * A storage object stores an arbitrary set of key-value pairs, which
14 * may be retrieved, modified and removed as needed. A key may only
15 * exist once within a storage object, and only one value may be
16 * associated with a particular key. Keys are stored in a particular
17 * order with the condition that this order not change by merely changing
18 * the value associated with a key, but the order may change when a
19 * key is added or removed.
20 */
22 [scriptable, uuid(43E5EDAD-1E02-42c4-9D99-C3D9DEE22A20)]
23 interface nsIDOMStorage : nsISupports
24 {
25 /**
26 * The number of keys stored.
27 */
28 readonly attribute unsigned long length;
30 /**
31 * Retrieve the name of the key at a particular index.
32 *
33 * @param index index of the item to retrieve
34 * @returns the key at index, null if there is no key at that index
35 */
36 DOMString key(in unsigned long index);
38 /**
39 * Retrieve an item with a given key
40 *
41 * @param key key to retrieve
42 * @returns found data or empty string if the key was not found
43 */
44 DOMString getItem([Null(Stringify)] in DOMString key);
46 /**
47 * Assign a value with a key. If the key does not exist already, a new
48 * key is added associated with that value. If the key already exists,
49 * then the existing value is replaced with a new value.
50 *
51 * @param key key to set
52 * @param data data to associate with the key
53 */
54 void setItem([Null(Stringify)] in DOMString key, [Null(Stringify)] in DOMString data);
56 /**
57 * Remove a key and its corresponding value.
58 *
59 * @param key key to remove
60 */
61 void removeItem([Null(Stringify)] in DOMString key);
63 /**
64 * Clear the content of this storage bound to a domain
65 * or an origin.
66 */
67 void clear();
68 };