imgICache.idl (3780B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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/. */ 6 7 #include "nsISupports.idl" 8 9 interface imgIRequest; 10 interface nsIPrincipal; 11 interface nsIProperties; 12 interface nsIURI; 13 14 webidl Document; 15 16 %{ C++ 17 namespace mozilla { 18 class OriginAttributes; 19 } // mozilla namespace 20 %} 21 22 [ptr] native OriginAttributesPtr(mozilla::OriginAttributes); 23 24 /** 25 * imgICache interface 26 * 27 * @author Stuart Parmenter <pavlov@netscape.com> 28 * @version 0.1 29 * @see imagelib2 30 */ 31 [scriptable, builtinclass, uuid(bfdf23ff-378e-402e-8a6c-840f0c82b6c3)] 32 interface imgICache : nsISupports 33 { 34 /** 35 * Evict images from the cache. 36 * 37 * @param chrome If passed and TRUE, evict only chrome images. 38 * If passed and FALSE, evict everything except chrome images. 39 * If not passed, evict all images. 40 * 41 * NOTE: Given that XPIDL doesn't support "was-not-passed" state for boolean, 42 * the chrome parameter uses jsval instead of boolean. 43 */ 44 void clearCache([optional] in jsval chrome); 45 46 /** 47 * Evict images from the cache. 48 * 49 * @param uri The URI to remove. 50 * @param doc The document to remove the cache entry for. 51 * @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from 52 * the cache. 53 */ 54 [noscript] void removeEntry(in nsIURI uri, [optional] in Document doc); 55 56 /** 57 * Evict images from the cache with the same origin and the same 58 * originAttributes of the passed principal, across all processes. May only be 59 * called from the parent process. 60 * 61 * @param aPrincipal The principal to clear cache entries for. The principals 62 * origin attributes are used to determine whether the private or normal 63 * browsing cache is cleared. 64 * @throws NS_ERROR_NOT_AVAILABLE if not called in the parent process. 65 */ 66 void removeEntriesFromPrincipalInAllProcesses(in nsIPrincipal aPrincipal); 67 68 /** 69 * Evict images from the non-chrome cache which match the the given site 70 * Matching cache entries will be cleared across all origin attributes 71 * and all processes. 72 * 73 * @param aSchemelessSite site (exlcuding scheme) to delete cache entries for. 74 * @throws NS_ERROR_NOT_AVAILABLE if not called in the parent process. 75 */ 76 [implicit_jscontext] 77 void removeEntriesFromSiteInAllProcesses(in ACString aBaseDomain, in jsval OriginAttributesPattern); 78 79 /** 80 * Find Properties 81 * Used to get properties such as 'type' and 'content-disposition' 82 * 'type' is a nsISupportsCString containing the images' mime type such as 83 * 'image/png' 84 * 'content-disposition' will be a nsISupportsCString containing the header 85 * If you call this before any data has been loaded from a URI, it will 86 * succeed, but come back empty. 87 * 88 * Hopefully this will be removed with bug 805119 89 * 90 * @param uri The URI to look up. 91 * @param doc Optional pointer to the document that the cache entry belongs to. 92 * @returns NULL if the URL was not found in the cache 93 */ 94 [must_use] 95 nsIProperties findEntryProperties(in nsIURI uri, 96 [optional] in Document doc); 97 98 /** 99 * Make this cache instance respect private browsing notifications. This 100 * entails clearing the chrome and content caches whenever the 101 * last-pb-context-exited notification is observed. 102 */ 103 void respectPrivacyNotifications(); 104 105 /** 106 * Clear the image cache for a document. Controlled documents are responsible 107 * for doing this manually when they get destroyed. 108 */ 109 [noscript, notxpcom] 110 void clearCacheForControlledDocument(in Document doc); 111 };