michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "domstubs.idl" michael@0: michael@0: /** michael@0: * Interface for client side storage. See michael@0: * http://www.whatwg.org/specs/web-apps/current-work/multipage/structured.html#storage0 michael@0: * for more information. michael@0: * michael@0: * A storage object stores an arbitrary set of key-value pairs, which michael@0: * may be retrieved, modified and removed as needed. A key may only michael@0: * exist once within a storage object, and only one value may be michael@0: * associated with a particular key. Keys are stored in a particular michael@0: * order with the condition that this order not change by merely changing michael@0: * the value associated with a key, but the order may change when a michael@0: * key is added or removed. michael@0: */ michael@0: michael@0: [scriptable, uuid(43E5EDAD-1E02-42c4-9D99-C3D9DEE22A20)] michael@0: interface nsIDOMStorage : nsISupports michael@0: { michael@0: /** michael@0: * The number of keys stored. michael@0: */ michael@0: readonly attribute unsigned long length; michael@0: michael@0: /** michael@0: * Retrieve the name of the key at a particular index. michael@0: * michael@0: * @param index index of the item to retrieve michael@0: * @returns the key at index, null if there is no key at that index michael@0: */ michael@0: DOMString key(in unsigned long index); michael@0: michael@0: /** michael@0: * Retrieve an item with a given key michael@0: * michael@0: * @param key key to retrieve michael@0: * @returns found data or empty string if the key was not found michael@0: */ michael@0: DOMString getItem([Null(Stringify)] in DOMString key); michael@0: michael@0: /** michael@0: * Assign a value with a key. If the key does not exist already, a new michael@0: * key is added associated with that value. If the key already exists, michael@0: * then the existing value is replaced with a new value. michael@0: * michael@0: * @param key key to set michael@0: * @param data data to associate with the key michael@0: */ michael@0: void setItem([Null(Stringify)] in DOMString key, [Null(Stringify)] in DOMString data); michael@0: michael@0: /** michael@0: * Remove a key and its corresponding value. michael@0: * michael@0: * @param key key to remove michael@0: */ michael@0: void removeItem([Null(Stringify)] in DOMString key); michael@0: michael@0: /** michael@0: * Clear the content of this storage bound to a domain michael@0: * or an origin. michael@0: */ michael@0: void clear(); michael@0: };