mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1202085 - Part 2: Add an optional document argument to imgICache::FindEntryProperties(); r=seth
This commit is contained in:
parent
3e757bfddd
commit
fb1ee97e21
@ -134,7 +134,7 @@ var handleContentContextMenu = function (event) {
|
||||
Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
|
||||
.getImgCacheForDocument(doc);
|
||||
let props =
|
||||
imageCache.findEntryProperties(event.target.currentURI);
|
||||
imageCache.findEntryProperties(event.target.currentURI, doc);
|
||||
try {
|
||||
contentType = props.get("type", Ci.nsISupportsCString).data;
|
||||
} catch(e) {}
|
||||
@ -1264,4 +1264,4 @@ var PageInfoListener = {
|
||||
return text.replace(endRE, "");
|
||||
}
|
||||
};
|
||||
PageInfoListener.init();
|
||||
PageInfoListener.init();
|
||||
|
@ -3128,7 +3128,8 @@ nsContentUtils::IsImageInCache(nsIURI* aURI, nsIDocument* aDocument)
|
||||
// If something unexpected happened we return false, otherwise if props
|
||||
// is set, the image is cached and we return true
|
||||
nsCOMPtr<nsIProperties> props;
|
||||
nsresult rv = cache->FindEntryProperties(aURI, getter_AddRefs(props));
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDocument);
|
||||
nsresult rv = cache->FindEntryProperties(aURI, domDoc, getter_AddRefs(props));
|
||||
return (NS_SUCCEEDED(rv) && props);
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,10 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface imgIRequest;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIProperties;
|
||||
interface nsIURI;
|
||||
|
||||
/**
|
||||
* imgICache interface
|
||||
@ -17,7 +18,7 @@ interface nsIProperties;
|
||||
* @version 0.1
|
||||
* @see imagelib2
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(6e62f5c9-95b5-4139-bb59-9cbaf14e9b3c)]
|
||||
[scriptable, builtinclass, uuid(6c1e3f96-4701-4c75-9883-217a790a53e2)]
|
||||
interface imgICache : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -40,9 +41,10 @@ interface imgICache : nsISupports
|
||||
* Hopefully this will be removed with bug 805119
|
||||
*
|
||||
* @param uri The URI to look up.
|
||||
* @param doc Optional pointer to the document that the cache entry belongs to.
|
||||
* @returns NULL if the URL was not found in the cache
|
||||
*/
|
||||
nsIProperties findEntryProperties(in nsIURI uri);
|
||||
nsIProperties findEntryProperties(in nsIURI uri, [optional] in nsIDOMDocument doc);
|
||||
|
||||
/**
|
||||
* Make this cache instance respect private browsing notifications. This
|
||||
|
@ -1335,7 +1335,9 @@ imgLoader::ClearCache(bool chrome)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
imgLoader::FindEntryProperties(nsIURI* uri, nsIProperties** _retval)
|
||||
imgLoader::FindEntryProperties(nsIURI* uri,
|
||||
nsIDOMDocument* doc,
|
||||
nsIProperties** _retval)
|
||||
{
|
||||
*_retval = nullptr;
|
||||
|
||||
|
@ -928,7 +928,7 @@ var BrowserApp = {
|
||||
let doc = aTarget.ownerDocument;
|
||||
let imageCache = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
|
||||
.getImgCacheForDocument(doc);
|
||||
let props = imageCache.findEntryProperties(aTarget.currentURI, doc.characterSet);
|
||||
let props = imageCache.findEntryProperties(aTarget.currentURI, doc);
|
||||
let src = aTarget.src;
|
||||
return {
|
||||
title: src,
|
||||
|
@ -112,7 +112,7 @@ function saveImageURL(aURL, aFileName, aFilePickerTitleKey, aShouldBypassCache,
|
||||
.getService(Components.interfaces.imgITools)
|
||||
.getImgCacheForDocument(aDoc);
|
||||
var props =
|
||||
imageCache.findEntryProperties(makeURI(aURL, getCharsetforSave(null)));
|
||||
imageCache.findEntryProperties(makeURI(aURL, getCharsetforSave(null)), aDoc);
|
||||
if (props) {
|
||||
aContentType = props.get("type", nsISupportsCString);
|
||||
aContentDisp = props.get("content-disposition", nsISupportsCString);
|
||||
|
Loading…
Reference in New Issue
Block a user