Bug 1519732 - fix AB photo drag, nsIWebBrowserPersist.saveURI() takes a principal parameter after bug 1469916. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Mon, 14 Jan 2019 23:26:35 +0100
changeset 33941 8039ee8e0391270d9bfd6c45571ee6d22ebcb2d0
parent 33940 c9e0cf17a0df6ef6fba09e888f6f11135d877319
child 33942 49745f62ea044bd2ed24961bc9e53ce42a8b554e
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersaceman, jorgk
bugs1519732, 1469916
Bug 1519732 - fix AB photo drag, nsIWebBrowserPersist.saveURI() takes a principal parameter after bug 1469916. r=aceman a=jorgk
mail/components/addrbook/content/abCard.js
mail/components/addrbook/content/abCommon.js
--- a/mail/components/addrbook/content/abCard.js
+++ b/mail/components/addrbook/content/abCard.js
@@ -1129,17 +1129,19 @@ var gPhotoDownloadUI = (function() {
     if (msg) {
       elProgressLabel.value = msg;
       elProgressbar.hidden = true;
       onSwitchPhotoType("generic");
     }
   }
 
   function onProgress(state, percent) {
-    elProgressbar.value = percent;
+    if (percent !== undefined) {
+      elProgressbar.value = percent;
+    }
     elProgressLabel.value = gAddressBookBundle.getString("stateImageSave");
   }
 
   return {
     onStart,
     onSuccess,
     onError,
     onProgress,
--- a/mail/components/addrbook/content/abCommon.js
+++ b/mail/components/addrbook/content/abCommon.js
@@ -1021,17 +1021,18 @@ var gImageDownloader = (function() {
     // Start the transfer to a temporary file.
     tempFile = FileUtils.getFile("TmpD", ["tb-photo-" + new Date().getTime() + ".tmp"]);
     tempFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
     try {
       // Obtain the privacy context of the browser window that the URL
       // we are downloading comes from. If, and only if, the URL is not
       // related to a window, null should be used instead.
       let privacy = PrivateBrowsingUtils.privacyContextFromWindow(window);
-      downloader.saveURI(source, null, null, null, null, null, tempFile, privacy);
+      let principal = Services.scriptSecurityManager.createCodebasePrincipal(source, {});
+      downloader.saveURI(source, principal, null, null, null, null, null, tempFile, privacy);
     } catch (err) {
       cleanup();
       if (callbackError) {
         callbackError(ERROR_SAVE);
       }
     }
   }
 
@@ -1164,17 +1165,18 @@ var gImageDownloader = (function() {
         }
       },
     };
 
     // Obtain the privacy context of the browser window that the URL
     // we are downloading comes from. If, and only if, the URL is not
     // related to a window, null should be used instead.
     let privacy = PrivateBrowsingUtils.privacyContextFromWindow(window);
-    downloader.saveURI(source, null, null, null, null, null, target, privacy);
+    let principal = Services.scriptSecurityManager.createCodebasePrincipal(source, {});
+    downloader.saveURI(source, principal, null, null, null, null, null, target, privacy);
   }
 
   // Publicly accessible methods.
   return {
     cancelSave,
     savePhoto,
     STATE_TRANSFERRING,
     STATE_RESIZING,