diff --git a/services/common/rest.js b/services/common/rest.js index 98cb6a71365..daf4dff6835 100644 --- a/services/common/rest.js +++ b/services/common/rest.js @@ -305,7 +305,12 @@ RESTRequest.prototype = { } // Create and initialize HTTP channel. - let channel = Services.io.newChannelFromURI(this.uri, null, null) + 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; diff --git a/services/sync/Weave.js b/services/sync/Weave.js index 1d982296f91..0116e70c743 100644 --- a/services/sync/Weave.js +++ b/services/sync/Weave.js @@ -180,7 +180,12 @@ AboutWeaveLog.prototype = { newChannel: function(aURI) { let dir = FileUtils.getDir("ProfD", ["weave", "logs"], true); let uri = Services.io.newFileURI(dir); - let channel = Services.io.newChannelFromURI(uri); + let channel = Services.io.newChannelFromURI2(uri, + null, // aLoadingNode + Services.scriptSecurityManager.getSystemPrincipal(), + null, // aTriggeringPrincipal + Ci.nsILoadInfo.SEC_NORMAL, + Ci.nsIContentPolicy.TYPE_OTHER); channel.originalURI = aURI; // Ensure that the about page has the same privileges as a regular directory diff --git a/services/sync/modules/resource.js b/services/sync/modules/resource.js index d53353eaff9..1c2a67b9021 100644 --- a/services/sync/modules/resource.js +++ b/services/sync/modules/resource.js @@ -146,7 +146,14 @@ AsyncResource.prototype = { // to obtain a request channel. // _createRequest: function Res__createRequest(method) { - let channel = Services.io.newChannel(this.spec, null, null) + 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); diff --git a/services/sync/tests/unit/test_errorhandler_filelog.js b/services/sync/tests/unit/test_errorhandler_filelog.js index 681e1daba4f..cfaedcb70c7 100644 --- a/services/sync/tests/unit/test_errorhandler_filelog.js +++ b/services/sync/tests/unit/test_errorhandler_filelog.js @@ -7,6 +7,7 @@ Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/util.js"); Cu.import("resource://gre/modules/FileUtils.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true); const LOG_PREFIX_SUCCESS = "success-"; @@ -81,11 +82,16 @@ add_test(function test_logOnSuccess_false() { }); function readFile(file, callback) { - NetUtil.asyncFetch(file, function (inputStream, statusCode, request) { + NetUtil.asyncFetch2(file, function (inputStream, statusCode, request) { let data = NetUtil.readInputStreamToString(inputStream, inputStream.available()); callback(statusCode, data); - }); + }, + null, // aLoadingNode + Services.scriptSecurityManager.getSystemPrincipal(), + null, // aTriggeringPrincipal + Ci.nsILoadInfo.SEC_NORMAL, + Ci.nsIContentPolicy.TYPE_OTHER); } add_test(function test_logOnSuccess_true() { diff --git a/services/sync/tps/extensions/tps/resource/modules/addons.jsm b/services/sync/tps/extensions/tps/resource/modules/addons.jsm index 0da1d991430..5c308b5c2aa 100644 --- a/services/sync/tps/extensions/tps/resource/modules/addons.jsm +++ b/services/sync/tps/extensions/tps/resource/modules/addons.jsm @@ -20,7 +20,14 @@ const STATE_ENABLED = 1; const STATE_DISABLED = 2; function GetFileAsText(file) { - let channel = Services.io.newChannel(file, null, null); + let channel = Services.io.newChannel2(file, + null, + null, + null, // aLoadingNode + Services.scriptSecurityManager.getSystemPrincipal(), + null, // aTriggeringPrincipal + Ci.nsILoadInfo.SEC_NORMAL, + Ci.nsIContentPolicy.TYPE_OTHER); let inputStream = channel.open(); if (channel instanceof Ci.nsIHttpChannel && channel.responseStatus != 200) {