Bug 1526591 - Remove devtools.inspector.shapesHighlighter.enabled pref. r=rcaliman
[gecko.git] / netwerk / base / nsIApplicationCache.idl
blob9922feb597b0949fda4c507fbbce2525b3c98a67
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface nsIArray;
10 interface nsIFile;
11 interface nsIURI;
13 /**
14 * Application caches can store a set of namespace entries that affect
15 * loads from the application cache. If a load from the cache fails
16 * to match an exact cache entry, namespaces entries will be searched
17 * for a substring match, and should be applied appropriately.
19 [scriptable, uuid(96e4c264-2065-4ce9-93bb-43734c62c4eb)]
20 interface nsIApplicationCacheNamespace : nsISupports
22 /**
23 * Items matching this namespace can be fetched from the network
24 * when loading from this cache. The "data" attribute is unused.
26 const unsigned long NAMESPACE_BYPASS = 1 << 0;
28 /**
29 * Items matching this namespace can be fetched from the network
30 * when loading from this cache. If the load fails, the cache entry
31 * specified by the "data" attribute should be loaded instead.
33 const unsigned long NAMESPACE_FALLBACK = 1 << 1;
35 /**
36 * Items matching this namespace should be cached
37 * opportunistically. Successful toplevel loads of documents
38 * in this namespace should be placed in the application cache.
39 * Namespaces specifying NAMESPACE_OPPORTUNISTIC may also specify
40 * NAMESPACE_FALLBACK to supply a fallback entry.
42 const unsigned long NAMESPACE_OPPORTUNISTIC = 1 << 2;
44 /**
45 * Initialize the namespace.
47 void init(in unsigned long itemType,
48 in ACString namespaceSpec,
49 in ACString data);
51 /**
52 * The namespace type.
54 readonly attribute unsigned long itemType;
56 /**
57 * The prefix of this namespace. This should be the asciiSpec of the
58 * URI prefix.
60 readonly attribute ACString namespaceSpec;
62 /**
63 * Data associated with this namespace, such as a fallback. URI data should
64 * use the asciiSpec of the URI.
66 readonly attribute ACString data;
69 /**
70 * Application caches store resources for offline use. Each
71 * application cache has a unique client ID for use with
72 * nsICacheService::openSession() to access the cache's entries.
74 * Each entry in the application cache can be marked with a set of
75 * types, as discussed in the WHAT-WG offline applications
76 * specification.
78 * All application caches with the same group ID belong to a cache
79 * group. Each group has one "active" cache that will service future
80 * loads. Inactive caches will be removed from the cache when they are
81 * no longer referenced.
83 [scriptable, uuid(06568DAE-C374-4383-A122-0CC96C7177F2)]
84 interface nsIApplicationCache : nsISupports
86 /**
87 * Init this application cache instance to just hold the group ID and
88 * the client ID to work just as a handle to the real cache. Used on
89 * content process to simplify the application cache code.
91 void initAsHandle(in ACString groupId, in ACString clientId);
93 /**
94 * Entries in an application cache can be marked as one or more of
95 * the following types.
98 /* This item is the application manifest. */
99 const unsigned long ITEM_MANIFEST = 1 << 0;
101 /* This item was explicitly listed in the application manifest. */
102 const unsigned long ITEM_EXPLICIT = 1 << 1;
104 /* This item was navigated in a toplevel browsing context, and
105 * named this cache's group as its manifest. */
106 const unsigned long ITEM_IMPLICIT = 1 << 2;
108 /* This item was added by the dynamic scripting API */
109 const unsigned long ITEM_DYNAMIC = 1 << 3;
111 /* This item was listed in the application manifest, but named a
112 * different cache group as its manifest. */
113 const unsigned long ITEM_FOREIGN = 1 << 4;
115 /* This item was listed as a fallback entry. */
116 const unsigned long ITEM_FALLBACK = 1 << 5;
118 /* This item matched an opportunistic cache namespace and was
119 * cached accordingly. */
120 const unsigned long ITEM_OPPORTUNISTIC = 1 << 6;
123 * URI of the manfiest specifying this application cache.
125 readonly attribute nsIURI manifestURI;
128 * The group ID for this cache group. It is an internally generated string
129 * and cannot be used as manifest URL spec.
131 readonly attribute ACString groupID;
134 * The client ID for this application cache. Clients can open a
135 * session with nsICacheService::createSession() using this client
136 * ID and a storage policy of STORE_OFFLINE to access this cache.
138 readonly attribute ACString clientID;
141 * TRUE if the cache is the active cache for this group.
143 readonly attribute boolean active;
146 * The disk usage of the application cache, in bytes.
148 readonly attribute unsigned long usage;
151 * Makes this cache the active application cache for this group.
152 * Future loads associated with this group will come from this
153 * cache. Other caches from this cache group will be deactivated.
155 void activate();
158 * Discard this application cache. Removes all cached resources
159 * for this cache. If this is the active application cache for the
160 * group, the group will be removed.
162 void discard();
165 * Adds item types to a given entry.
167 void markEntry(in ACString key, in unsigned long typeBits);
170 * Removes types from a given entry. If the resulting entry has
171 * no types left, the entry is removed.
173 void unmarkEntry(in ACString key, in unsigned long typeBits);
176 * Gets the types for a given entry.
178 unsigned long getTypes(in ACString key);
181 * Returns any entries in the application cache whose type matches
182 * one or more of the bits in typeBits.
184 void gatherEntries(in uint32_t typeBits,
185 out unsigned long count,
186 [array, size_is(count)] out string keys);
189 * Add a set of namespace entries to the application cache.
190 * @param namespaces
191 * An nsIArray of nsIApplicationCacheNamespace entries.
193 void addNamespaces(in nsIArray namespaces);
196 * Get the most specific namespace matching a given key.
198 nsIApplicationCacheNamespace getMatchingNamespace(in ACString key);
201 * If set, this offline cache is placed in a different directory
202 * than the current application profile.
204 readonly attribute nsIFile profileDirectory;