|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 interface OfflineResourceList : EventTarget { |
|
6 /** |
|
7 * State of the application cache this object is associated with. |
|
8 */ |
|
9 |
|
10 /* This object is not associated with an application cache. */ |
|
11 const unsigned short UNCACHED = 0; |
|
12 |
|
13 /* The application cache is not being updated. */ |
|
14 const unsigned short IDLE = 1; |
|
15 |
|
16 /* The manifest is being fetched and checked for updates */ |
|
17 const unsigned short CHECKING = 2; |
|
18 |
|
19 /* Resources are being downloaded to be added to the cache */ |
|
20 const unsigned short DOWNLOADING = 3; |
|
21 |
|
22 /* There is a new version of the application cache available */ |
|
23 const unsigned short UPDATEREADY = 4; |
|
24 |
|
25 /* The application cache group is now obsolete. */ |
|
26 const unsigned short OBSOLETE = 5; |
|
27 |
|
28 [Throws] |
|
29 readonly attribute unsigned short status; |
|
30 |
|
31 /** |
|
32 * Begin the application update process on the associated application cache. |
|
33 */ |
|
34 [Throws] |
|
35 void update(); |
|
36 |
|
37 /** |
|
38 * Swap in the newest version of the application cache, or disassociate |
|
39 * from the cache if the cache group is obsolete. |
|
40 */ |
|
41 [Throws] |
|
42 void swapCache(); |
|
43 |
|
44 /* Events */ |
|
45 attribute EventHandler onchecking; |
|
46 attribute EventHandler onerror; |
|
47 attribute EventHandler onnoupdate; |
|
48 attribute EventHandler ondownloading; |
|
49 attribute EventHandler onprogress; |
|
50 attribute EventHandler onupdateready; |
|
51 attribute EventHandler oncached; |
|
52 attribute EventHandler onobsolete; |
|
53 }; |
|
54 |
|
55 // Mozilla extensions. |
|
56 partial interface OfflineResourceList { |
|
57 /** |
|
58 * Get the list of dynamically-managed entries. |
|
59 */ |
|
60 [Throws] |
|
61 readonly attribute DOMStringList mozItems; |
|
62 |
|
63 /** |
|
64 * Check that an entry exists in the list of dynamically-managed entries. |
|
65 * |
|
66 * @param uri |
|
67 * The resource to check. |
|
68 */ |
|
69 [Throws] |
|
70 boolean mozHasItem(DOMString uri); |
|
71 |
|
72 /** |
|
73 * Get the number of dynamically-managed entries. |
|
74 * @status DEPRECATED |
|
75 * Clients should use the "items" attribute. |
|
76 */ |
|
77 [Throws] |
|
78 readonly attribute unsigned long mozLength; |
|
79 |
|
80 /** |
|
81 * Get the URI of a dynamically-managed entry. |
|
82 * @status DEPRECATED |
|
83 * Clients should use the "items" attribute. |
|
84 */ |
|
85 [Throws] |
|
86 getter DOMString mozItem(unsigned long index); |
|
87 |
|
88 /** |
|
89 * Add an item to the list of dynamically-managed entries. The resource |
|
90 * will be fetched into the application cache. |
|
91 * |
|
92 * @param uri |
|
93 * The resource to add. |
|
94 */ |
|
95 [Throws] |
|
96 void mozAdd(DOMString uri); |
|
97 |
|
98 /** |
|
99 * Remove an item from the list of dynamically-managed entries. If this |
|
100 * was the last reference to a URI in the application cache, the cache |
|
101 * entry will be removed. |
|
102 * |
|
103 * @param uri |
|
104 * The resource to remove. |
|
105 */ |
|
106 [Throws] |
|
107 void mozRemove(DOMString uri); |
|
108 }; |