Backed out 4 changesets (bug 1230221, bug 1230220, bug 1229890) for m-e10s(2) permafails in test_window_open_close.html CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 04 Dec 2015 15:58:40 -0800
changeset 309906 3aacf4a7163451db74ecc2a7693876502f6f08b3
parent 309905 1de4d57e6fa3d78feeeca4ef25e781aeb7be7165
child 309907 3d00b054f0b05f2e294452db0a174acb95853646
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1230221, 1230220, 1229890
milestone45.0a1
backs outa1cd28ddbfa2a2afb8330ad43c7d5d0591f1e34b
7e89f5020ac710bc147256911f4fb76cf2d9c41e
91f6e72fa9f4b591f24313fa825d4e9c8be21152
7e717a810420851e1acabfbbb44dd3238d396974
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 4 changesets (bug 1230221, bug 1230220, bug 1229890) for m-e10s(2) permafails in test_window_open_close.html CLOSED TREE Backed out changeset a1cd28ddbfa2 (bug 1230221) Backed out changeset 7e89f5020ac7 (bug 1230220) Backed out changeset 91f6e72fa9f4 (bug 1229890) Backed out changeset 7e717a810420 (bug 1229890)
extensions/cookie/test/test_app_uninstall_cookies.html
image/test/unit/async_load_tests.js
image/test/unit/test_private_channel.js
modules/libjar/test/unit/test_bug370103.js
modules/libjar/test/unit/test_bug407303.js
modules/libjar/test/unit/test_jarchannel.js
services/common/rest.js
services/sync/modules/resource.js
--- a/extensions/cookie/test/test_app_uninstall_cookies.html
+++ b/extensions/cookie/test/test_app_uninstall_cookies.html
@@ -23,17 +23,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 const Ci = Components.interfaces;
 const Cc = Components.classes;
 const Cu = Components.utils;
 
 SimpleTest.waitForExplicitFinish();
 
 Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 var httpserver = new HttpServer();
 
 var cookieSetPath = "/setcookie";
 var cookieCheckPath = "/checkcookie";
 
 var permManager = Cc["@mozilla.org/permissionmanager;1"]
                     .getService(Ci.nsIPermissionManager);
 var cookieMng = Cc["@mozilla.org/cookiemanager;1"]
@@ -89,27 +89,34 @@ function cookieCheckHandler(metadata, re
 
   response.setStatusLine(metadata.httpVersion, 200, "Ok");
   response.setHeader("foo-saw-cookies", cookies, false);
   response.setHeader("Content-Type", "text/plain");
   response.bodyOutputStream.write("Ok", "Ok".length);
 }
 
 function setupChannel(path) {
-  var url = NetUtil.newURI("http://localhost:4444" + path);
-  var chan = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
+  var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
+  var chan = ios.newChannel2("http://localhost:4444" + path,
+                             "",
+                             null,
+                             null,      // aLoadingNode
+                             Services.scriptSecurityManager.getSystemPrincipal(),
+                             null,      // aTriggeringPrincipal
+                             Ci.nsILoadInfo.SEC_NORMAL,
+                             Ci.nsIContentPolicy.TYPE_OTHER);
   chan.notificationCallbacks = cookies[counter].loadContext;
   chan.QueryInterface(Ci.nsIHttpChannel);
   return chan;
 }
 
 function setCookie() {
   var channel = setupChannel(cookieSetPath);
   channel.setRequestHeader("foo-set-cookie", cookies[counter].cookieName, false);
-  channel.asyncOpen2(new ChannelListener(setNextCookie, null));
+  channel.asyncOpen(new ChannelListener(setNextCookie, null), null);
 }
 
 function setNextCookie(request, data, context) {
   if (++counter == cookies.length) {
     // all cookies set: switch to checking them
     counter = 0;
     checkCookie();
   } else {
--- a/image/test/unit/async_load_tests.js
+++ b/image/test/unit/async_load_tests.js
@@ -7,17 +7,17 @@
  */
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 var Cr = Components.results;
 
 Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 var server = new HttpServer();
 server.registerDirectory("/", do_get_file(''));
 server.registerContentType("sjs", "sjs");
 server.start(-1);
 
 
 load('image_load_helpers.js');
@@ -120,19 +120,26 @@ function getChannelLoadImageStopCallback
   }
 }
 
 // Load the request a second time. This should come from the image cache, and
 // therefore would be at most risk of being served synchronously.
 function checkSecondChannelLoad()
 {
   do_test_pending();
-  var channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
+
+  var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);  
+  var channel = ioService.newChannelFromURI2(uri,
+                                             null,      // aLoadingNode
+                                             Services.scriptSecurityManager.getSystemPrincipal(),
+                                             null,      // aTriggeringPrincipal
+                                             Ci.nsILoadInfo.SEC_NORMAL,
+                                             Ci.nsIContentPolicy.TYPE_OTHER);
   var channellistener = new ChannelListener();
-  channel.asyncOpen2(channellistener);
+  channel.asyncOpen(channellistener, null);
 
   var listener = new ImageListener(null,
                                    getChannelLoadImageStopCallback(channellistener,
                                                                    all_done_callback));
   var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
                 .createScriptedObserver(listener);
   var outlistener = {};
   requests.push(gCurrentLoader.loadImageWithChannelXPCOM(channel, outer, null, outlistener));
@@ -142,19 +149,26 @@ function checkSecondChannelLoad()
 }
 
 function run_loadImageWithChannel_tests()
 {
   // To ensure we're testing what we expect to, create a new loader and cache.
   gCurrentLoader = Cc["@mozilla.org/image/loader;1"].createInstance(Ci.imgILoader);
 
   do_test_pending();
-  var channel =  NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
+
+  var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);  
+  var channel = ioService.newChannelFromURI2(uri,
+                                             null,      // aLoadingNode
+                                             Services.scriptSecurityManager.getSystemPrincipal(),
+                                             null,      // aTriggeringPrincipal
+                                             Ci.nsILoadInfo.SEC_NORMAL,
+                                             Ci.nsIContentPolicy.TYPE_OTHER);
   var channellistener = new ChannelListener();
-  channel.asyncOpen2(channellistener);
+  channel.asyncOpen(channellistener, null);
 
   var listener = new ImageListener(null,
                                    getChannelLoadImageStopCallback(channellistener,
                                                                    checkSecondChannelLoad));
   var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
                 .createScriptedObserver(listener);
   var outlistener = {};
   requests.push(gCurrentLoader.loadImageWithChannelXPCOM(channel, outer, null, outlistener));
--- a/image/test/unit/test_private_channel.js
+++ b/image/test/unit/test_private_channel.js
@@ -1,15 +1,14 @@
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://testing-common/httpd.js");
 
 var server = new HttpServer();
 server.registerPathHandler('/image.png', imageHandler);
 server.start(-1);
 
 load('image_load_helpers.js');
 
@@ -49,21 +48,26 @@ NotificationCallbacks.prototype = {
     throw Cr.NS_ERROR_NO_INTERFACE;
   },
   originAttributes: {}
 };
 
 var gImgPath = 'http://localhost:' + server.identity.primaryPort + '/image.png';
 
 function setup_chan(path, isPrivate, callback) {
-  var uri = NetUtil.newURI(gImgPath);
-  var chan =  NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
+  var uri = gIoService.newURI(gImgPath, null, null);
+  var chan = gIoService.newChannelFromURI2(uri,
+                                           null,      // aLoadingNode
+                                           Services.scriptSecurityManager.getSystemPrincipal(),
+                                           null,      // aTriggeringPrincipal
+                                           Ci.nsILoadInfo.SEC_NORMAL,
+                                           Ci.nsIContentPolicy.TYPE_OTHER);
   chan.notificationCallbacks = new NotificationCallbacks(isPrivate);
   var channelListener = new ChannelListener();
-  chan.asyncOpen2(channelListener);
+  chan.asyncOpen(channelListener, null);
 
   var listener = new ImageListener(null, callback);
   var outlistener = {};
   var loader = isPrivate ? gPrivateLoader : gPublicLoader;
   var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
                 .createScriptedObserver(listener);
   listeners.push(outer);
   requests.push(loader.loadImageWithChannelXPCOM(chan, outer, null, outlistener));
--- a/modules/libjar/test/unit/test_bug370103.js
+++ b/modules/libjar/test/unit/test_bug370103.js
@@ -1,28 +1,35 @@
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
-Cu.import("resource://gre/modules/NetUtil.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
 
 // Regression test for bug 370103 - crash when passing a null listener to
 // nsIChannel.asyncOpen
 function run_test() {
   // Compose the jar: url
   var ioService = Cc["@mozilla.org/network/io-service;1"].
                     getService(Ci.nsIIOService);
   var file = do_get_file("data/test_bug370103.jar");
   var url = ioService.newFileURI(file).spec;
   url = "jar:" + url + "!/test_bug370103";
 
   // Try opening channel with null listener
-  var channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
+  var channel = ioService.newChannel2(url,
+                                      null,
+                                      null,
+                                      null,      // aLoadingNode
+                                      Services.scriptSecurityManager.getSystemPrincipal(),
+                                      null,      // aTriggeringPrincipal
+                                      Ci.nsILoadInfo.SEC_NORMAL,
+                                      Ci.nsIContentPolicy.TYPE_OTHER);
 
   var exception = false;
   try {
-    channel.asyncOpen2(null);
+    channel.asyncOpen(null, null);
   }
   catch(e) {
     exception = true;
   }
 
   do_check_true(exception); // should throw exception instead of crashing
 }
--- a/modules/libjar/test/unit/test_bug407303.js
+++ b/modules/libjar/test/unit/test_bug407303.js
@@ -1,16 +1,15 @@
 // Regression test for bug 407303 - A failed channel should not be checked
 // for an unsafe content type.
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
 
 // XXX: NS_ERROR_UNKNOWN_HOST is not in Components.results
 const NS_ERROR_UNKNOWN_HOST = 0x804B001E;
 
 var listener = {
   QueryInterface: function(iid) {
     if (iid.equals(Ci.nsISupports) ||
         iid.equals(Ci.nsIRequestObserver))
@@ -28,15 +27,23 @@ var listener = {
   onStopRequest: function(request, context, status) {
     do_check_eq(status, NS_ERROR_UNKNOWN_HOST);
     do_test_finished();
   }
 };
 
 function run_test() {
   Services.prefs.setBoolPref("network.jar.block-remote-files", false);
-  var channel = NetUtil.newChannel({
-    uri: "jar:http://test.invalid/test.jar!/index.html",
-    loadUsingSystemPrincipal: true}
-  );
-  channel.asyncOpen2(listener);
+
+  var ios = Cc["@mozilla.org/network/io-service;1"].
+            getService(Ci.nsIIOService);
+
+  var channel = ios.newChannel2("jar:http://test.invalid/test.jar!/index.html",
+                                null,
+                                null,
+                                null,      // aLoadingNode
+                                Services.scriptSecurityManager.getSystemPrincipal(),
+                                null,      // aTriggeringPrincipal
+                                Ci.nsILoadInfo.SEC_NORMAL,
+                                Ci.nsIContentPolicy.TYPE_OTHER);
+  channel.asyncOpen(listener, null);
   do_test_pending();
 }
--- a/modules/libjar/test/unit/test_jarchannel.js
+++ b/modules/libjar/test/unit/test_jarchannel.js
@@ -10,17 +10,16 @@
 const {classes: Cc,
        interfaces: Ci,
        results: Cr,
        utils: Cu,
        Constructor: ctor
        } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
 
 const ios = Cc["@mozilla.org/network/io-service;1"].
                 getService(Ci.nsIIOService);
 const dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                 getService(Ci.nsIProperties);
 const obs = Cc["@mozilla.org/observer-service;1"].
                 getService(Ci.nsIObserverService);
 
@@ -71,40 +70,54 @@ Listener.prototype = {
     }
 };
 
 /**
  * Basic reading test for asynchronously opened jar channel
  */
 function testAsync() {
     var uri = jarBase + "/inner40.zip";
-    var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
+    var chan = ios.newChannel2(uri,
+                               null,
+                               null,
+                               null,      // aLoadingNode
+                               Services.scriptSecurityManager.getSystemPrincipal(),
+                               null,      // aTriggeringPrincipal
+                               Ci.nsILoadInfo.SEC_NORMAL,
+                               Ci.nsIContentPolicy.TYPE_OTHER);
     do_check_true(chan.contentLength < 0);
-    chan.asyncOpen2(new Listener(function(l) {
+    chan.asyncOpen(new Listener(function(l) {
         do_check_true(chan.contentLength > 0);
         do_check_true(l.gotStartRequest);
         do_check_true(l.gotStopRequest);
         do_check_eq(l.available, chan.contentLength);
 
         run_next_test();
-    }));
+    }), null);
 }
 
 add_test(testAsync);
 // Run same test again so we test the codepath for a zipcache hit
 add_test(testAsync);
 
 /**
  * Basic test for nsIZipReader.
  * This relies on the jar cache to succeed in child processes.
  */
 function testZipEntry() {
     var uri = jarBase + "/inner40.zip";
-    var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
-                      .QueryInterface(Ci.nsIJARChannel);
+    var chan = ios.newChannel2(uri,
+                               null,
+                               null,
+                               null,      // aLoadingNode
+                               Services.scriptSecurityManager.getSystemPrincipal(),
+                               null,      // aTriggeringPrincipal
+                               Ci.nsILoadInfo.SEC_NORMAL,
+                               Ci.nsIContentPolicy.TYPE_OTHER)
+                  .QueryInterface(Ci.nsIJARChannel);
     var entry = chan.zipEntry;
     do_check_true(entry.CRC32 == 0x8b635486);
     do_check_true(entry.realSize == 184);
     run_next_test();
 }
 
 add_test(testZipEntry);
 
@@ -114,69 +127,98 @@ add_test(testZipEntry);
 // 3) we can't do file lock checks on android, so skip those tests too.
 if (!inChild) {
 
   /**
    * Basic reading test for synchronously opened jar channels
    */
   add_test(function testSync() {
       var uri = jarBase + "/inner40.zip";
-      var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
-      var stream = chan.open2();
+      var chan = ios.newChannel2(uri,
+                                 null,
+                                 null,
+                                 null,      // aLoadingNode
+                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                 null,      // aTriggeringPrincipal
+                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      var stream = chan.open();
       do_check_true(chan.contentLength > 0);
       do_check_eq(stream.available(), chan.contentLength);
       stream.close();
       stream.close(); // should still not throw
 
       run_next_test();
   });
 
 
   /**
    * Basic reading test for synchronously opened, nested jar channels
    */
   add_test(function testSyncNested() {
       var uri = "jar:" + jarBase + "/inner40.zip!/foo";
-      var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
-      var stream = chan.open2();
+      var chan = ios.newChannel2(uri,
+                                 null,
+                                 null,
+                                 null,      // aLoadingNode
+                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                 null,      // aTriggeringPrincipal
+                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      var stream = chan.open();
       do_check_true(chan.contentLength > 0);
       do_check_eq(stream.available(), chan.contentLength);
       stream.close();
       stream.close(); // should still not throw
 
       run_next_test();
   });
 
   /**
    * Basic reading test for asynchronously opened, nested jar channels
    */
   add_test(function testAsyncNested(next) {
       var uri = "jar:" + jarBase + "/inner40.zip!/foo";
-      var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
-      chan.asyncOpen2(new Listener(function(l) {
+      var chan = ios.newChannel2(uri,
+                                 null,
+                                 null,
+                                 null,      // aLoadingNode
+                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                 null,      // aTriggeringPrincipal
+                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      chan.asyncOpen(new Listener(function(l) {
           do_check_true(chan.contentLength > 0);
           do_check_true(l.gotStartRequest);
           do_check_true(l.gotStopRequest);
           do_check_eq(l.available, chan.contentLength);
 
           run_next_test();
-      }));
+      }), null);
   });
 
   /**
    * Verify that file locks are released when closing a synchronously
    * opened jar channel stream
    */
   add_test(function testSyncCloseUnlocks() {
       var copy = tmpDir.clone();
       copy.append(fileBase);
       file.copyTo(copy.parent, copy.leafName);
+
       var uri = "jar:" + ios.newFileURI(copy).spec + "!/inner40.zip";
-      var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
-      var stream = chan.open2();
+      var chan = ios.newChannel2(uri,
+                                 null,
+                                 null,
+                                 null,      // aLoadingNode
+                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                 null,      // aTriggeringPrincipal
+                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      var stream = chan.open();
       do_check_true(chan.contentLength > 0);
       stream.close();
 
       // Drop any jar caches
       obs.notifyObservers(null, "chrome-flush-caches", null);
 
       try {
           copy.remove(false);
@@ -193,33 +235,39 @@ if (!inChild) {
    * opened jar channel stream
    */
   add_test(function testAsyncCloseUnlocks() {
       var copy = tmpDir.clone();
       copy.append(fileBase);
       file.copyTo(copy.parent, copy.leafName);
 
       var uri = "jar:" + ios.newFileURI(copy).spec + "!/inner40.zip";
-      var chan = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});
-
-      chan.asyncOpen2(new Listener(function (l) {
+      var chan = ios.newChannel2(uri,
+                                 null,
+                                 null,
+                                 null,      // aLoadingNode
+                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                 null,      // aTriggeringPrincipal
+                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      chan.asyncOpen(new Listener(function (l) {
           do_check_true(chan.contentLength > 0);
 
           // Drop any jar caches
           obs.notifyObservers(null, "chrome-flush-caches", null);
 
           try {
               copy.remove(false);
           }
           catch (ex) {
               do_throw(ex);
           }
 
           run_next_test();
-      }));
+      }), null);
   });
 
 } // if !inChild
 
 if (inChild) {
     /**
      * Multiple simultaneous opening test for bug 1048615
      */
@@ -228,23 +276,40 @@ if (inChild) {
 
         // Drop any JAR caches
         obs.notifyObservers(null, "chrome-flush-caches", null);
 
         // Open multiple channels
         var num = 10;
         var chan = [];
         for (var i = 0; i < num; i++) {
-            chan[i] = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
-                             .QueryInterface(Ci.nsIJARChannel);
-            chan[i].asyncOpen2(new Listener(function(l) {}));
+            chan[i] = ios.newChannel2(uri,
+                                      null,
+                                      null,
+                                      null,      // aLoadingNode
+                                      Services.scriptSecurityManager.getSystemPrincipal(),
+                                      null,      // aTriggeringPrincipal
+                                      Ci.nsILoadInfo.SEC_NORMAL,
+                                      Ci.nsIContentPolicy.TYPE_OTHER)
+                         .QueryInterface(Ci.nsIJARChannel);
+            chan[i].asyncOpen(new Listener(function(l) {
+            }), null);
         }
 
         // Open the last channel
-        var chan_last = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true})
-                               .QueryInterface(Ci.nsIJARChannel);
-        chan_last.asyncOpen2(new Listener(function(l) { run_next_test(); }));
+        var chan_last = ios.newChannel2(uri,
+                                        null,
+                                        null,
+                                        null,      // aLoadingNode
+                                        Services.scriptSecurityManager.getSystemPrincipal(),
+                                        null,      // aTriggeringPrincipal
+                                        Ci.nsILoadInfo.SEC_NORMAL,
+                                        Ci.nsIContentPolicy.TYPE_OTHER)
+                           .QueryInterface(Ci.nsIJARChannel);
+        chan_last.asyncOpen(new Listener(function(l) {
+            run_next_test();
+        }), null);
     });
 } // if inChild
 
 function run_test() {
   return run_next_test();
 }
--- a/services/common/rest.js
+++ b/services/common/rest.js
@@ -11,17 +11,16 @@ this.EXPORTED_SYMBOLS = [
   "RESTResponse",
   "TokenAuthenticatedRESTRequest",
 ];
 
 #endif
 
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Log.jsm");
 Cu.import("resource://services-common/utils.js");
 
 XPCOMUtils.defineLazyModuleGetter(this, "CryptoUtils",
                                   "resource://services-crypto/utils.js");
 
 const Prefs = new Preferences("services.common.rest.");
@@ -301,19 +300,24 @@ RESTRequest.prototype = {
     if (onComplete) {
       this.onComplete = onComplete;
     }
     if (onProgress) {
       this.onProgress = onProgress;
     }
 
     // Create and initialize HTTP channel.
-    let channel = NetUtil.newChannel({uri: this.uri, loadUsingSystemPrincipal: true})
-                         .QueryInterface(Ci.nsIRequest)
-                         .QueryInterface(Ci.nsIHttpChannel);
+    let channel = Services.io.newChannelFromURI2(this.uri,
+                                                 null,      // aLoadingNode
+                                                 Services.scriptSecurityManager.getSystemPrincipal(),
+                                                 null,      // aTriggeringPrincipal
+                                                 Ci.nsILoadInfo.SEC_NORMAL,
+                                                 Ci.nsIContentPolicy.TYPE_OTHER)
+                          .QueryInterface(Ci.nsIRequest)
+                          .QueryInterface(Ci.nsIHttpChannel);
     this.channel = channel;
     channel.loadFlags |= this.loadFlags;
     channel.notificationCallbacks = this;
 
     // Set request headers.
     let headers = this._headers;
     for (let key in headers) {
       if (key == 'authorization') {
@@ -349,17 +353,17 @@ RESTRequest.prototype = {
     channel.requestMethod = method;
 
     // Before opening the channel, set the charset that serves as a hint
     // as to what the response might be encoded as.
     channel.contentCharset = this.charset;
 
     // Blast off!
     try {
-      channel.asyncOpen2(this);
+      channel.asyncOpen(this, null);
     } catch (ex) {
       // asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
       this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
       CommonUtils.nextTick(onComplete.bind(this, ex));
     }
     this.status = this.SENT;
     this.delayTimeout();
     return this;
--- a/services/sync/modules/resource.js
+++ b/services/sync/modules/resource.js
@@ -8,17 +8,16 @@ this.EXPORTED_SYMBOLS = [
 ];
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Preferences.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://services-common/async.js");
 Cu.import("resource://gre/modules/Log.jsm");
 Cu.import("resource://services-common/observers.js");
 Cu.import("resource://services-common/utils.js");
 Cu.import("resource://services-sync/constants.js");
 Cu.import("resource://services-sync/util.js");
 
 const DEFAULT_LOAD_FLAGS =
@@ -144,19 +143,26 @@ AsyncResource.prototype = {
 
   // ** {{{ AsyncResource._createRequest }}} **
   //
   // This method returns a new IO Channel for requests to be made
   // through. It is never called directly, only {{{_doRequest}}} uses it
   // to obtain a request channel.
   //
   _createRequest: function Res__createRequest(method) {
-    let channel = NetUtil.newChannel({uri: this.spec, loadUsingSystemPrincipal: true})
-                         .QueryInterface(Ci.nsIRequest)
-                         .QueryInterface(Ci.nsIHttpChannel);
+    let channel = Services.io.newChannel2(this.spec,
+                                          null,
+                                          null,
+                                          null,      // aLoadingNode
+                                          Services.scriptSecurityManager.getSystemPrincipal(),
+                                          null,      // aTriggeringPrincipal
+                                          Ci.nsILoadInfo.SEC_NORMAL,
+                                          Ci.nsIContentPolicy.TYPE_OTHER)
+                          .QueryInterface(Ci.nsIRequest)
+                          .QueryInterface(Ci.nsIHttpChannel);
 
     channel.loadFlags |= DEFAULT_LOAD_FLAGS;
 
     // Setup a callback to handle channel notifications.
     let listener = new ChannelNotificationListener(this.headerNames);
     channel.notificationCallbacks = listener;
 
     // Compose a UA string fragment from the various available identifiers.
@@ -219,19 +225,19 @@ AsyncResource.prototype = {
     }
 
     // Setup a channel listener so that the actual network operation
     // is performed asynchronously.
     let listener = new ChannelListener(this._onComplete, this._onProgress,
                                        this._log, this.ABORT_TIMEOUT);
     channel.requestMethod = action;
     try {
-      channel.asyncOpen2(listener);
+      channel.asyncOpen(listener, null);
     } catch (ex) {
-      // asyncOpen2 can throw in a bunch of cases -- e.g., a forbidden port.
+      // asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
       this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
       CommonUtils.nextTick(callback.bind(this, ex));
     }
   },
 
   _onComplete: function _onComplete(error, data, channel) {
     this._log.trace("In _onComplete. Error is " + error + ".");