Bug 824737 - Use ContentAreaUtils for saving images. r=mfinkle, a=akeybl
authorWes Johnston <wjohnston@mozilla.com>
Fri, 11 Jan 2013 09:23:47 -0800
changeset 127118 83ab7d93d8998a563488445ddc6c54c462d7449d
parent 127117 ad6a01269c341c48733ed0e58d65efe8ab569acf
child 127119 f9deba82d43b0d55e669ef67a06c2d925519f77d
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, akeybl
bugs824737
milestone20.0a2
Bug 824737 - Use ContentAreaUtils for saving images. r=mfinkle, a=akeybl
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -462,31 +462,19 @@ var BrowserApp = {
             mime: type,
           }
         });
       });
 
     NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.saveImage"),
       NativeWindow.contextmenus.imageSaveableContext,
       function(aTarget) {
-        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 contentDisposition = "";
-        let type = "";
-        try {
-           contentDisposition = String(props.get("content-disposition", Ci.nsISupportsCString));
-           type = String(props.get("type", Ci.nsISupportsCString));
-        } catch(ex) {
-           contentDisposition = "";
-           type = "";
-        }
-        ContentAreaUtils.internalSave(aTarget.currentURI.spec, null, null, contentDisposition, type, false, "SaveImageTitle", null,
-                                      aTarget.ownerDocument.documentURIObject, aTarget.ownerDocument, true, null);
+        ContentAreaUtils.saveImageURL(aTarget.currentURI.spec, null, "SaveImageTitle",
+                                      false, true, aTarget.ownerDocument.documentURIObject,
+                                      aTarget.ownerDocument);
       });
 
     NativeWindow.contextmenus.add(Strings.browser.GetStringFromName("contextmenu.setWallpaper"),
       NativeWindow.contextmenus.imageSaveableContext,
       function(aTarget) {
         let src = aTarget.src;
         sendMessageToJava({
           gecko: {
@@ -1719,17 +1707,16 @@ var NativeWindow = {
 
       this.menuitems = null;
       if (selectedItem && selectedItem.callback) {
         if (selectedItem.matches) {
           // for menuitems added using the native UI, pass the dom element that matched that item to the callback
           while (aTarget) {
             if (selectedItem.matches(aTarget, aX, aY)) {
               selectedItem.callback.call(selectedItem, aTarget, aX, aY);
-              foundNode = true;
               break;
             }
             aTarget = aTarget.parentNode;
           }
         } else {
           // if this was added using the html5 context menu api, just click on the context menu item
           selectedItem.callback.call(selectedItem, aTarget, aX, aY);
         }