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: interface OfflineResourceList : EventTarget { michael@0: /** michael@0: * State of the application cache this object is associated with. michael@0: */ michael@0: michael@0: /* This object is not associated with an application cache. */ michael@0: const unsigned short UNCACHED = 0; michael@0: michael@0: /* The application cache is not being updated. */ michael@0: const unsigned short IDLE = 1; michael@0: michael@0: /* The manifest is being fetched and checked for updates */ michael@0: const unsigned short CHECKING = 2; michael@0: michael@0: /* Resources are being downloaded to be added to the cache */ michael@0: const unsigned short DOWNLOADING = 3; michael@0: michael@0: /* There is a new version of the application cache available */ michael@0: const unsigned short UPDATEREADY = 4; michael@0: michael@0: /* The application cache group is now obsolete. */ michael@0: const unsigned short OBSOLETE = 5; michael@0: michael@0: [Throws] michael@0: readonly attribute unsigned short status; michael@0: michael@0: /** michael@0: * Begin the application update process on the associated application cache. michael@0: */ michael@0: [Throws] michael@0: void update(); michael@0: michael@0: /** michael@0: * Swap in the newest version of the application cache, or disassociate michael@0: * from the cache if the cache group is obsolete. michael@0: */ michael@0: [Throws] michael@0: void swapCache(); michael@0: michael@0: /* Events */ michael@0: attribute EventHandler onchecking; michael@0: attribute EventHandler onerror; michael@0: attribute EventHandler onnoupdate; michael@0: attribute EventHandler ondownloading; michael@0: attribute EventHandler onprogress; michael@0: attribute EventHandler onupdateready; michael@0: attribute EventHandler oncached; michael@0: attribute EventHandler onobsolete; michael@0: }; michael@0: michael@0: // Mozilla extensions. michael@0: partial interface OfflineResourceList { michael@0: /** michael@0: * Get the list of dynamically-managed entries. michael@0: */ michael@0: [Throws] michael@0: readonly attribute DOMStringList mozItems; michael@0: michael@0: /** michael@0: * Check that an entry exists in the list of dynamically-managed entries. michael@0: * michael@0: * @param uri michael@0: * The resource to check. michael@0: */ michael@0: [Throws] michael@0: boolean mozHasItem(DOMString uri); michael@0: michael@0: /** michael@0: * Get the number of dynamically-managed entries. michael@0: * @status DEPRECATED michael@0: * Clients should use the "items" attribute. michael@0: */ michael@0: [Throws] michael@0: readonly attribute unsigned long mozLength; michael@0: michael@0: /** michael@0: * Get the URI of a dynamically-managed entry. michael@0: * @status DEPRECATED michael@0: * Clients should use the "items" attribute. michael@0: */ michael@0: [Throws] michael@0: getter DOMString mozItem(unsigned long index); michael@0: michael@0: /** michael@0: * Add an item to the list of dynamically-managed entries. The resource michael@0: * will be fetched into the application cache. michael@0: * michael@0: * @param uri michael@0: * The resource to add. michael@0: */ michael@0: [Throws] michael@0: void mozAdd(DOMString uri); michael@0: michael@0: /** michael@0: * Remove an item from the list of dynamically-managed entries. If this michael@0: * was the last reference to a URI in the application cache, the cache michael@0: * entry will be removed. michael@0: * michael@0: * @param uri michael@0: * The resource to remove. michael@0: */ michael@0: [Throws] michael@0: void mozRemove(DOMString uri); michael@0: };