Bug 1665644 [wpt PR 25599] - HTML: Add test for <input type=tel> matching :dir()...
[gecko.git] / netwerk / cache2 / nsICacheStorageService.idl
blobc3aa08e555039117d421248f3fd89fac7ed407df
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/. */
5 #include "nsISupports.idl"
7 interface nsICacheStorage;
8 interface nsILoadContextInfo;
9 interface nsIApplicationCache;
10 interface nsIEventTarget;
11 interface nsICacheStorageConsumptionObserver;
12 interface nsICacheStorageVisitor;
13 interface nsIPrincipal;
15 /**
16 * Provides access to particual cache storages of the network URI cache.
18 [scriptable, uuid(ae29c44b-fbc3-4552-afaf-0a157ce771e7)]
19 interface nsICacheStorageService : nsISupports
21 /**
22 * Get storage where entries will only remain in memory, never written
23 * to the disk.
25 * NOTE: Any existing disk entry for [URL|id-extension] will be doomed
26 * prior opening an entry using this memory-only storage. Result of
27 * AsyncOpenURI will be a new and empty memory-only entry. Using
28 * OPEN_READONLY open flag has no effect on this behavior.
30 * @param aLoadContextInfo
31 * Information about the loading context, this focuses the storage JAR and
32 * respects separate storage for private browsing.
34 nsICacheStorage memoryCacheStorage(in nsILoadContextInfo aLoadContextInfo);
36 /**
37 * Get storage where entries will be written to disk when not forbidden by
38 * response headers.
40 * @param aLookupAppCache
41 * When set true (for top level document loading channels) app cache will
42 * be first to check on to find entries in.
44 nsICacheStorage diskCacheStorage(in nsILoadContextInfo aLoadContextInfo,
45 in bool aLookupAppCache);
47 /**
48 * Get storage where entries will be written to disk and marked as pinned.
49 * These pinned entries are immune to over limit eviction and call of clear()
50 * on this service.
52 nsICacheStorage pinningCacheStorage(in nsILoadContextInfo aLoadContextInfo);
54 /**
55 * Get storage for a specified application cache obtained using some different
56 * mechanism.
58 * @param aLoadContextInfo
59 * Mandatory reference to a load context information.
60 * @param aApplicationCache
61 * Optional reference to an existing appcache. When left null, this will
62 * work with offline cache as a whole.
64 nsICacheStorage appCacheStorage(in nsILoadContextInfo aLoadContextInfo,
65 in nsIApplicationCache aApplicationCache);
67 /**
68 * Get storage for synthesized cache entries that we currently use for ServiceWorker interception in non-e10s mode.
70 * This cache storage has no limits on file size to allow the ServiceWorker to intercept large files.
72 nsICacheStorage synthesizedCacheStorage(in nsILoadContextInfo aLoadContextInfo);
74 /**
75 * Evict any cache entry having the same origin of aPrincipal.
77 * @param aPrincipal
78 * The principal to compare the entries with.
80 void clearOrigin(in nsIPrincipal aPrincipal);
82 /**
83 * Evict any cache entry having the same originAttributes.
85 * @param aOriginAttributes
86 * The origin attributes in string format to compare the entries with.
88 void clearOriginAttributes(in AString aOriginAttributes);
90 /**
91 * Evict the whole cache.
93 void clear();
95 /**
96 * Purge only data of disk backed entries. Metadata are left for
97 * performance purposes.
99 const uint32_t PURGE_DISK_DATA_ONLY = 1;
101 * Purge whole disk backed entries from memory. Disk files will
102 * be left unattended.
104 const uint32_t PURGE_DISK_ALL = 2;
106 * Purge all entries we keep in memory, including memory-storage
107 * entries. This may be dangerous to use.
109 const uint32_t PURGE_EVERYTHING = 3;
111 * Purges data we keep warmed in memory. Use for tests and for
112 * saving memory.
114 void purgeFromMemory(in uint32_t aWhat);
117 * I/O thread target to use for any operations on disk
119 readonly attribute nsIEventTarget ioTarget;
122 * Asynchronously determine how many bytes of the disk space the cache takes.
123 * @see nsICacheStorageConsumptionObserver
124 * @param aObserver
125 * A mandatory (weak referred) observer. Documented at
126 * nsICacheStorageConsumptionObserver.
127 * NOTE: the observer MUST implement nsISupportsWeakReference.
129 void asyncGetDiskConsumption(in nsICacheStorageConsumptionObserver aObserver);
132 * Asynchronously visits all storages of the disk cache and memory cache.
133 * @see nsICacheStorageVisitor
134 * @param aVisitor
135 * A visitor callback.
136 * @param aVisitEntries
137 * A boolean indicates whether visits entries.
139 void asyncVisitAllStorages(in nsICacheStorageVisitor aVisitor,
140 in boolean aVisitEntries);
143 [scriptable, uuid(7728ab5b-4c01-4483-a606-32bf5b8136cb)]
144 interface nsICacheStorageConsumptionObserver : nsISupports
147 * Callback invoked to answer asyncGetDiskConsumption call. Always triggered
148 * on the main thread.
149 * NOTE: implementers must also implement nsISupportsWeakReference.
151 * @param aDiskSize
152 * The disk consumption in bytes.
154 void onNetworkCacheDiskConsumption(in int64_t aDiskSize);