Bug 1610357 [wpt PR 21278] - Update wpt metadata, a=testonly
[gecko.git] / image / imgICache.idl
blobe27c15948c036c799e479d7b2ddaacdebe2da2c2
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 imgIRequest;
10 interface nsIPrincipal;
11 interface nsIProperties;
12 interface nsIURI;
14 webidl Document;
16 %{ C++
17 namespace mozilla {
18 class OriginAttributes;
19 } // mozilla namespace
22 [ptr] native OriginAttributesPtr(mozilla::OriginAttributes);
24 /**
25 * imgICache interface
27 * @author Stuart Parmenter <pavlov@netscape.com>
28 * @version 0.1
29 * @see imagelib2
31 [scriptable, builtinclass, uuid(bfdf23ff-378e-402e-8a6c-840f0c82b6c3)]
32 interface imgICache : nsISupports
34 /**
35 * Evict images from the cache.
37 * @param chrome If TRUE, evict only chrome images.
38 * If FALSE, evict everything except chrome images.
40 void clearCache(in boolean chrome);
42 /**
43 * Evict images from the cache.
45 * @param uri The URI to remove.
46 * @param doc The document to remove the cache entry for.
47 * @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from
48 * the cache.
50 [noscript] void removeEntry(in nsIURI uri, [optional] in Document doc);
52 /**
53 * Evict images from the cache with the same origin and the same
54 * originAttributes of the passed principal.
56 * @param aPrincipal The principal
58 void removeEntriesFromPrincipal(in nsIPrincipal aPrincipal);
60 /**
61 * Find Properties
62 * Used to get properties such as 'type' and 'content-disposition'
63 * 'type' is a nsISupportsCString containing the images' mime type such as
64 * 'image/png'
65 * 'content-disposition' will be a nsISupportsCString containing the header
66 * If you call this before any data has been loaded from a URI, it will
67 * succeed, but come back empty.
69 * Hopefully this will be removed with bug 805119
71 * @param uri The URI to look up.
72 * @param doc Optional pointer to the document that the cache entry belongs to.
73 * @returns NULL if the URL was not found in the cache
75 [must_use]
76 nsIProperties findEntryProperties(in nsIURI uri,
77 [optional] in Document doc);
79 /**
80 * Make this cache instance respect private browsing notifications. This
81 * entails clearing the chrome and content caches whenever the
82 * last-pb-context-exited notification is observed.
84 void respectPrivacyNotifications();
86 /**
87 * Clear the image cache for a document. Controlled documents are responsible
88 * for doing this manually when they get destroyed.
90 [noscript, notxpcom]
91 void clearCacheForControlledDocument(in Document doc);