imgICache 编辑
image/public/imgICache.idl
Scriptable Please add a summary to this article. Inherits from: nsISupports
Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)As of Firefox 18, there is no longer a single image cache. That means that using getService in order to obtain it will yield incorrect results. Use the following snippet to obtain a relevant image cache for a given document or channel (where relevantDocument is a Document object that contains images you care about, or relevantChannel is an nsIChannel that is used for fetching images):
var tools = Components.classes["@mozilla.org/image/tools;1"].getService(Components.interfaces.imgITools); var cache = tools.getImgCacheForDocument(relevantDocument); // alternatively, tools.getImgCacheForChannel(relevantChannel)
If there is no relevant document or channel, null may be passed, but this will cause any image cache requests to use the permanent storage cache (ie. any images from windows in private browsing mode will not be present in the cache returned from a call with a null parameter).
Method overview
void clearCache(in boolean chrome); |
nsIProperties findEntryProperties(in nsIURI uri); |
void removeEntry(in nsIURI uri); |
Methods
clearCache()
Evict images from the cache.
void clearCache( in boolean chrome );
Parameters
chrome
- If
true
, evict only chrome images. Iffalse
, evict everything except chrome images.
findEntryProperties()
Find Properties Used to get properties such as 'type' and 'content-disposition' 'type' is a nsISupportsCString
containing the images' mime type such as 'image/png' 'content-disposition' will be a nsISupportsCString
containing the header If you call this before any data has been loaded from a URI, it will succeed, but come back empty.
nsIProperties findEntryProperties( in nsIURI uri );
Parameters
uri
- The URI to look up.
Return value
null
if the URL was not found in the cache.
removeEntry()
Evict images from the cache.
void removeEntry( in nsIURI uri );
Parameters
uri
- The URI to remove.
Exceptions thrown
NS_OK
- If a uri was removed from the cache.
NS_ERROR_NOT_AVAILABLE
- If a uri was unable to be removed from the cache.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论