dom/interfaces/storage/nsIDOMStorage.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial