Backed out changeset 740b66ce102b (bug 1239913) for mochitest bustage
authorNigel Babu <nigelbabu@gmail.com>
Fri, 15 Jan 2016 13:31:40 +0530
changeset 322083 068744df86e5628c1ad3532ca9b5e3ba10c773c4
parent 322082 3f5a7f35db7479643fd27850f7fe880aeb0c2cdd
child 322084 891f03cc619317c6f584a67e7969eec6879e037b
push id9530
push userdmitchell@mozilla.com
push dateFri, 15 Jan 2016 19:42:24 +0000
bugs1239913
milestone46.0a1
backs out740b66ce102b182973f16c2ecbb8149ca38f3306
Backed out changeset 740b66ce102b (bug 1239913) for mochitest bustage
toolkit/components/jsdownloads/src/DownloadCore.jsm
toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
--- a/toolkit/components/jsdownloads/src/DownloadCore.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadCore.jsm
@@ -1958,17 +1958,17 @@ this.DownloadCopySaver.prototype = {
               aSetProgressBytesFn(currentBytes, totalBytes, aProgress > 0 &&
                                   partFilePath && keepPartialData);
             },
             onStatus: function () { },
           };
 
           // Open the channel, directing output to the background file saver.
           backgroundFileSaver.QueryInterface(Ci.nsIStreamListener);
-          channel.asyncOpen2({
+          channel.asyncOpen({
             onStartRequest: function (aRequest, aContext) {
               backgroundFileSaver.onStartRequest(aRequest, aContext);
 
               // Check if the request's response has been blocked by Windows
               // Parental Controls with an HTTP 450 error code.
               if (aRequest instanceof Ci.nsIHttpChannel &&
                   aRequest.responseStatus == 450) {
                 // Set a flag that can be retrieved later when handling the
@@ -2060,17 +2060,17 @@ this.DownloadCopySaver.prototype = {
             }.bind(copySaver),
 
             onDataAvailable: function (aRequest, aContext, aInputStream,
                                        aOffset, aCount) {
               backgroundFileSaver.onDataAvailable(aRequest, aContext,
                                                   aInputStream, aOffset,
                                                   aCount);
             }.bind(copySaver),
-          });
+          }, null);
 
           // We should check if we have been canceled in the meantime, after
           // all the previous asynchronous operations have been executed and
           // just before we set the _backgroundFileSaver property.
           if (this._canceled) {
             throw new DownloadError({ message: "Saver canceled." });
           }
 
--- a/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
+++ b/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js
@@ -22,18 +22,16 @@ const PARTIAL_LENGTH = 4;
 //              ceiling on the time to wait.
 
 const BACKOFF_ERRORS = 2;
 const BACKOFF_INTERVAL = 30 * 60 * 1000;
 const BACKOFF_MAX = 8 * 60 * 60 * 1000;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
 
 // Log only if browser.safebrowsing.debug is true
 function log(...stuff) {
   let logging = null;
   try {
     logging = Services.prefs.getBoolPref("browser.safebrowsing.debug");
   } catch(e) {
     return;
@@ -233,20 +231,23 @@ HashCompleterRequest.prototype = {
     }
   },
 
   // Creates an nsIChannel for the request and fills the body.
   openChannel: function HCR_openChannel() {
     let loadFlags = Ci.nsIChannel.INHIBIT_CACHING |
                     Ci.nsIChannel.LOAD_BYPASS_CACHE;
 
-    let channel = NetUtil.newChannel({
-      uri: this.gethashUrl,
-      loadUsingSystemPrincipal: true
-    });
+    let uri = Services.io.newURI(this.gethashUrl, null, null);
+    let channel = Services.io.newChannelFromURI2(uri,
+                                                 null,      // aLoadingNode
+                                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                                 null,      // aTriggeringPrincipal
+                                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                                 Ci.nsIContentPolicy.TYPE_OTHER);
     channel.loadFlags = loadFlags;
 
     // Disable keepalive.
     let httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
     httpChannel.setRequestHeader("Connection", "close", false);
 
     this._channel = channel;
 
@@ -255,17 +256,17 @@ HashCompleterRequest.prototype = {
 
     // Set a timer that cancels the channel after timeout_ms in case we
     // don't get a gethash response.
     this.timer_ = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
     // Ask the timer to use nsITimerCallback (.notify()) when ready
     let timeout = Services.prefs.getIntPref(
       "urlclassifier.gethash.timeout_ms");
     this.timer_.initWithCallback(this, timeout, this.timer_.TYPE_ONE_SHOT);
-    channel.asyncOpen2(this);
+    channel.asyncOpen(this, null);
   },
 
   // Returns a string for the request body based on the contents of
   // this._requests.
   buildRequest: function HCR_buildRequest() {
     // Sometimes duplicate entries are sent to HashCompleter but we do not need
     // to propagate these to the server. (bug 633644)
     let prefixes = [];