Bug 1147562 - Update remaining callsites of newChannel before landing the shim in toolkit/ (r=gijs)
--- a/toolkit/components/addoncompat/tests/addon/bootstrap.js
+++ b/toolkit/components/addoncompat/tests/addon/bootstrap.js
@@ -265,18 +265,19 @@ function testAddonContent()
// registered in the parent, and that the child can browse to each of
// the registered about: pages.
function testAboutModuleRegistration()
{
let Registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
let modulesToUnregister = new Map();
- function TestChannel(uri, aboutName) {
+ function TestChannel(uri, aLoadInfo, aboutName) {
this.aboutName = aboutName;
+ this.loadInfo = aLoadInfo;
this.URI = this.originalURI = uri;
}
TestChannel.prototype = {
asyncOpen: function(listener, context) {
let stream = this.open();
let runnable = {
run: () => {
@@ -356,18 +357,18 @@ function testAboutModuleRegistration()
let AboutModule = function() {};
AboutModule.prototype = {
classID: Components.ID(uuid),
classDescription: `Testing About Module for about:${aboutName}`,
contractID: `@mozilla.org/network/protocol/about;1?what=${aboutName}`,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
- newChannel: (aURI) => {
- return new TestChannel(aURI, aboutName);
+ newChannel: (aURI, aLoadInfo) => {
+ return new TestChannel(aURI, aLoadInfo, aboutName);
},
getURIFlags: (aURI) => {
return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
Ci.nsIAboutModule.ALLOW_SCRIPT;
},
};
--- a/toolkit/components/thumbnails/PageThumbsProtocol.js
+++ b/toolkit/components/thumbnails/PageThumbsProtocol.js
@@ -67,28 +67,28 @@ Protocol.prototype = {
let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
uri.spec = aSpec;
return uri;
},
/**
* Constructs a new channel from the given URI for this protocol handler.
* @param aURI The URI for which to construct a channel.
+ * @param aLoadInfo The Loadinfo which to use on the channel.
* @return The newly created channel.
*/
- newChannel: function Proto_newChannel(aURI) {
+ newChannel2: function Proto_newChannel2(aURI, aLoadInfo) {
let {url} = parseURI(aURI);
let file = PageThumbsStorage.getFilePathForURL(url);
let fileuri = Services.io.newFileURI(new FileUtils.File(file));
- return Services.io.newChannelFromURI2(fileuri,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_IMAGE);
+ return Services.io.newChannelFromURIWithLoadInfo(fileuri, aLoadInfo);
+ },
+
+ newChannel: function Proto_newChannel(aURI) {
+ return newChannel2(aURI, null);
},
/**
* Decides whether to allow a blacklisted port.
* @return Always false, we'll never allow ports.
*/
allowPort: function () false,
--- a/toolkit/devtools/server/actors/actor-registry.js
+++ b/toolkit/devtools/server/actors/actor-registry.js
@@ -89,17 +89,20 @@ function request(uri) {
reject(e);
}
if (uri.scheme != "resource") {
reject(new Error(
"Can only register actors whose URI scheme is 'resource'."));
}
- NetUtil.asyncFetch(uri, (stream, status, req) => {
+ NetUtil.asyncFetch({
+ uri,
+ loadUsingSystemPrincipal: true,
+ }, (stream, status, req) => {
if (!components.isSuccessCode(status)) {
reject(new Error("Request failed with status code = "
+ status
+ " after NetUtil.asyncFetch for url = "
+ uri));
return;
}
--- a/toolkit/mozapps/extensions/test/browser/browser_openDialog.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_openDialog.js
@@ -15,30 +15,27 @@ let CustomChromeProtocol = {
newURI: function CCP_newURI(aSpec, aOriginCharset, aBaseUri) {
let uri = Cc["@mozilla.org/network/simple-uri;1"].
createInstance(Ci.nsIURI);
uri.spec = aSpec;
return uri;
},
- newChannel: function CCP_newChannel(aURI) {
- let url = "chrome:" + aURI.path;
- let ch = NetUtil.newChannel2(url,
- null,
- null,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER);
+ newChannel2: function CCP_newChannel2(aURI, aLoadInfo) {
+ let url = Services.io.newURI("chrome:" + aURI.path, null, null);
+ let ch = Services.io.newChannelFromURIWithLoadInfo(url, aLoadInfo);
ch.originalURI = aURI;
return ch;
},
+ newChannel: function CCP_newChannel(aURI) {
+ return newChannel2(aURI, null);
+ },
+
allowPort: function CCP_allowPort(aPort, aScheme) {
return false;
},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIProtocolHandler
]),