mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 638523 - Save Image saves htm, not the image [r=mbrubeck]
This commit is contained in:
parent
c55869127e
commit
f996480c18
@ -52,8 +52,16 @@ var ContextCommands = {
|
||||
},
|
||||
|
||||
saveImage: function cc_saveImage() {
|
||||
let browser = ContextHelper.popupState.target;
|
||||
ContentAreaUtils.saveImageURL(ContextHelper.popupState.mediaURL, null, "SaveImageTitle", false, true, browser.documentURI);
|
||||
let popupState = ContextHelper.popupState;
|
||||
let browser = popupState.target;
|
||||
|
||||
// Bug 638523
|
||||
// Using directly SaveImageURL fails here since checking the cache for a
|
||||
// remote page seems to not work (could it be nsICacheSession prohibition)?
|
||||
ContentAreaUtils.internalSave(popupState.mediaURL, null, null,
|
||||
popupState.contentDisposition,
|
||||
popupState.contentType, false, "SaveImageTitle",
|
||||
null, browser.documentURI, false, null);
|
||||
},
|
||||
|
||||
shareLink: function cc_shareLink() {
|
||||
|
@ -804,6 +804,20 @@ var ContextHandler = {
|
||||
if (popupNode instanceof Ci.nsIImageLoadingContent && popupNode.currentURI) {
|
||||
state.types.push("image");
|
||||
state.label = state.mediaURL = popupNode.currentURI.spec;
|
||||
|
||||
// Retrieve the type of image from the cache since the url can fail to
|
||||
// provide valuable informations
|
||||
try {
|
||||
let imageCache = Cc["@mozilla.org/image/cache;1"].getService(Ci.imgICache);
|
||||
let props = imageCache.findEntryProperties(popupNode.currentURI, content.document.characterSet);
|
||||
if (props) {
|
||||
state.contentType = String(props.get("type", Ci.nsISupportsCString));
|
||||
state.contentDisposition = String(props.get("content-disposition", Ci.nsISupportsCString));
|
||||
}
|
||||
} catch (e) {
|
||||
// Failure to get type and content-disposition off the image is non-fatal
|
||||
}
|
||||
|
||||
} else if (popupNode instanceof Ci.nsIDOMHTMLMediaElement) {
|
||||
state.label = state.mediaURL = (popupNode.currentSrc || popupNode.src);
|
||||
state.types.push((popupNode.paused || popupNode.ended) ? "media-paused" : "media-playing");
|
||||
|
Loading…
Reference in New Issue
Block a user