Bug 1246736 - Remove SEC_NORMAL from uriloader/ (r=sicking)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Mon, 08 Feb 2016 12:41:40 -0800
changeset 297196 780ff62f4452c8a6237422c56133df8017feb521
parent 297195 0ee899fa0bf018a7ce7d257a8780d306a6ec41b7
child 297197 bdeeb5e0c9a6e77c57e0affa17e6b033e7e3ab9c
push id76646
push usermozilla@christophkerschbaumer.com
push dateThu, 12 May 2016 17:46:57 +0000
treeherdermozilla-inbound@780ff62f4452 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1246736
milestone49.0a1
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
Bug 1246736 - Remove SEC_NORMAL from uriloader/ (r=sicking)
uriloader/exthandler/nsWebHandlerApp.js
uriloader/exthandler/tests/unit_ipc/test_encoding.js
--- a/uriloader/exthandler/nsWebHandlerApp.js
+++ b/uriloader/exthandler/nsWebHandlerApp.js
@@ -6,17 +6,17 @@
 //// Constants
 
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cc = Components.classes;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/NetUtil.jsm");
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsWebHandler class
 
 function nsWebHandlerApp() {}
 
 nsWebHandlerApp.prototype = {
   //////////////////////////////////////////////////////////////////////////////
@@ -90,22 +90,20 @@ nsWebHandlerApp.prototype = {
         return;
       } catch (e) {
         if (e.result != Cr.NS_NOINTERFACE) {
           throw e;
         }
       }
 
       // create a channel from this URI
-      var channel = ioService.newChannelFromURI2(uriToSend,
-                                                 null,      // aLoadingNode
-                                                 Services.scriptSecurityManager.getSystemPrincipal(),
-                                                 null,      // aTriggeringPrincipal
-                                                 Ci.nsILoadInfo.SEC_NORMAL,
-                                                 Ci.nsIContentPolicy.TYPE_OTHER);
+      var channel = NetUtil.newChannel({
+        uri: uriToSend,
+        loadUsingSystemPrincipal: true
+      });
       channel.loadFlags = Ci.nsIChannel.LOAD_DOCUMENT_URI;
 
       // load the channel
       var uriLoader = Cc["@mozilla.org/uriloader;1"].
                       getService(Ci.nsIURILoader);
       // XXX ideally, whether to pass the IS_CONTENT_PREFERRED flag should be
       // passed in from above.  Practically, the flag is probably a reasonable
       // default since browsers don't care much, and link click is likely to be
--- a/uriloader/exthandler/tests/unit_ipc/test_encoding.js
+++ b/uriloader/exthandler/tests/unit_ipc/test_encoding.js
@@ -1,17 +1,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/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://testing-common/MockRegistrar.js");
 
 do_get_profile();
 
 var DownloadListener = {
   init: function () {
     let obs = Services.obs;
     obs.addObserver(this, "dl-done", true);
@@ -109,24 +109,19 @@ function testFinisher(endFunc) {
     runNextTest();
   }
 }
 
 function runChildTestSet(set)
 {
   DownloadListener.onFinished = testFinisher(set[2]);
   sendCommand('\
-  let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null);                  \
-  let channel = ioservice.newChannelFromURI2(uri,                                                 \
-                                             null, /* aLoadingNode */                             \
-                                             Services.scriptSecurityManager.getSystemPrincipal(), \
-                                             null, /* aTriggeringPrincipal */                     \
-                                             Ci.nsILoadInfo.SEC_NORMAL,                           \
-                                             Ci.nsIContentPolicy.TYPE_OTHER);                     \
-  uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext());          \
+  let uri = ioservice.newURI("http://localhost:4444' + set[0] + '", null, null);          \
+  let channel = NetUtil.newChannel({uri: uri, loadUsingSystemPrincipal: true});           \
+  uriloader.openURI(channel, Ci.nsIURILoader.IS_CONTENT_PREFERRED, new WindowContext());  \
   ');
 }
 
 var httpserver = null;
 var currentTest = 0;
 function runNextTest()
 {
   if (currentTest == tests.length) {