Bug 1572305 - Use channel.asyncOpen2() in nsContextMenu.js. r=IanN a=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sun, 11 Aug 2019 14:19:37 +0200
changeset 32265 b5591f82670fdfc851993e69e7821b36b78f8801
parent 32264 9808d6a96ac92330212e2c8a9e441e6550dae2f3
child 32266 97ed3c58b08a9d5b8d468e774e96fbf0de467ba3
push id209
push userfrgrahl@gmx.net
push dateSun, 11 Aug 2019 12:21:39 +0000
treeherdercomm-esr60@7a01e33fff91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1572305, 1223225
Bug 1572305 - Use channel.asyncOpen2() in nsContextMenu.js. r=IanN a=IanN Port Bug 1223225 "Use channel.asyncOpen2() in browser/base/content/nsContextMenu.js"
suite/base/content/nsContextMenu.js
--- a/suite/base/content/nsContextMenu.js
+++ b/suite/base/content/nsContextMenu.js
@@ -1149,22 +1149,22 @@ nsContextMenu.prototype = {
     // If we don't have the headers after a short time the user won't have
     // received any feedback from the click. That's bad, so we give up
     // waiting for the filename.
     function timerCallback() {
       channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
     }
 
     // set up a channel to do the saving
-    var ios = Services.io;
-    var channel = ios.newChannel2(linkURL, null, null, null,
-                                  Services.scriptSecurityManager.getSystemPrincipal(),
-                                  null,
-                                  Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                  Ci.nsIContentPolicy.TYPE_OTHER);
+    var channel = NetUtil.newChannel({
+                    uri: makeURI(linkURL),
+                    loadUsingSystemPrincipal: true,
+                    securityFlags: Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL
+                  });
+
     channel.notificationCallbacks = new Callbacks();
 
     var flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
 
     if (bypassCache)
       flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
 
     if (channel instanceof Ci.nsICachingChannel)