|
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/. */ |
|
5 |
|
6 #include "domstubs.idl" |
|
7 |
|
8 [scriptable, uuid(6044702d-e4a9-420c-b711-558b7d6a3b9f)] |
|
9 interface nsIDOMOfflineResourceList : nsISupports |
|
10 { |
|
11 /** |
|
12 * Get the list of dynamically-managed entries. |
|
13 */ |
|
14 readonly attribute nsISupports mozItems; |
|
15 |
|
16 /** |
|
17 * Check that an entry exists in the list of dynamically-managed entries. |
|
18 * |
|
19 * @param uri |
|
20 * The resource to check. |
|
21 */ |
|
22 boolean mozHasItem(in DOMString uri); |
|
23 |
|
24 /** |
|
25 * Get the number of dynamically-managed entries. |
|
26 * @status DEPRECATED |
|
27 * Clients should use the "items" attribute. |
|
28 */ |
|
29 readonly attribute unsigned long mozLength; |
|
30 |
|
31 /** |
|
32 * Get the URI of a dynamically-managed entry. |
|
33 * @status DEPRECATED |
|
34 * Clients should use the "items" attribute. |
|
35 */ |
|
36 DOMString mozItem(in unsigned long index); |
|
37 |
|
38 /** |
|
39 * Add an item to the list of dynamically-managed entries. The resource |
|
40 * will be fetched into the application cache. |
|
41 * |
|
42 * @param uri |
|
43 * The resource to add. |
|
44 */ |
|
45 void mozAdd(in DOMString uri); |
|
46 |
|
47 /** |
|
48 * Remove an item from the list of dynamically-managed entries. If this |
|
49 * was the last reference to a URI in the application cache, the cache |
|
50 * entry will be removed. |
|
51 * |
|
52 * @param uri |
|
53 * The resource to remove. |
|
54 */ |
|
55 void mozRemove(in DOMString uri); |
|
56 |
|
57 /** |
|
58 * State of the application cache this object is associated with. |
|
59 */ |
|
60 |
|
61 /* This object is not associated with an application cache. */ |
|
62 const unsigned short UNCACHED = 0; |
|
63 |
|
64 /* The application cache is not being updated. */ |
|
65 const unsigned short IDLE = 1; |
|
66 |
|
67 /* The manifest is being fetched and checked for updates */ |
|
68 const unsigned short CHECKING = 2; |
|
69 |
|
70 /* Resources are being downloaded to be added to the cache */ |
|
71 const unsigned short DOWNLOADING = 3; |
|
72 |
|
73 /* There is a new version of the application cache available */ |
|
74 const unsigned short UPDATEREADY = 4; |
|
75 |
|
76 /* The application cache group is now obsolete. */ |
|
77 const unsigned short OBSOLETE = 5; |
|
78 |
|
79 readonly attribute unsigned short status; |
|
80 |
|
81 /** |
|
82 * Begin the application update process on the associated application cache. |
|
83 */ |
|
84 void update(); |
|
85 |
|
86 /** |
|
87 * Swap in the newest version of the application cache, or disassociate |
|
88 * from the cache if the cache group is obsolete. |
|
89 */ |
|
90 void swapCache(); |
|
91 |
|
92 /* Events */ |
|
93 [implicit_jscontext] attribute jsval onchecking; |
|
94 [implicit_jscontext] attribute jsval onerror; |
|
95 [implicit_jscontext] attribute jsval onnoupdate; |
|
96 [implicit_jscontext] attribute jsval ondownloading; |
|
97 [implicit_jscontext] attribute jsval onprogress; |
|
98 [implicit_jscontext] attribute jsval onupdateready; |
|
99 [implicit_jscontext] attribute jsval oncached; |
|
100 [implicit_jscontext] attribute jsval onobsolete; |
|
101 }; |