mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Bug 1087744: Make JS callers of ios.newChannel call ios.newChannel2 in toolkit/ (r=gijs)
This commit is contained in:
parent
01f03b1b49
commit
fe39ce0539
@ -670,7 +670,12 @@ function loadMemoryReportsFromFile(aFilename, aTitleNote, aFn)
|
||||
}, null);
|
||||
|
||||
let file = new nsFile(aFilename);
|
||||
let fileChan = Services.io.newChannelFromURI(Services.io.newFileURI(file));
|
||||
let fileChan = Services.io.newChannelFromURI2(Services.io.newFileURI(file),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
fileChan.asyncOpen(converter, null);
|
||||
|
||||
} catch (ex) {
|
||||
|
@ -1455,7 +1455,12 @@ Engine.prototype = {
|
||||
|
||||
LOG("_initFromURIAndLoad: Downloading engine from: \"" + this._uri.spec + "\".");
|
||||
|
||||
var chan = NetUtil.ioService.newChannelFromURI(this._uri);
|
||||
var chan = NetUtil.ioService.newChannelFromURI2(this._uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
if (this._engineToUpdate && (chan instanceof Ci.nsIHttpChannel)) {
|
||||
var lastModified = engineMetadataService.getAttr(this._engineToUpdate,
|
||||
@ -1518,7 +1523,12 @@ Engine.prototype = {
|
||||
|
||||
LOG("_initFromURISync: Loading engine from: \"" + this._uri.spec + "\".");
|
||||
|
||||
var chan = NetUtil.ioService.newChannelFromURI(this._uri);
|
||||
var chan = NetUtil.ioService.newChannelFromURI2(this._uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
var stream = chan.open();
|
||||
var parser = Cc["@mozilla.org/xmlextras/domparser;1"].
|
||||
@ -1835,7 +1845,12 @@ Engine.prototype = {
|
||||
getBoolPref(BROWSER_SEARCH_PREF + "cache.enabled", true)) {
|
||||
LOG("_setIcon: Downloading icon: \"" + uri.spec +
|
||||
"\" for engine: \"" + this.name + "\"");
|
||||
var chan = NetUtil.ioService.newChannelFromURI(uri);
|
||||
var chan = NetUtil.ioService.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
|
||||
let iconLoadCallback = function (aByteArray, aEngine) {
|
||||
// This callback may run after we've already set a preferred icon,
|
||||
@ -3870,7 +3885,12 @@ SearchService.prototype = {
|
||||
let listURL = root + "list.txt";
|
||||
let names = [];
|
||||
try {
|
||||
let chan = NetUtil.ioService.newChannelFromURI(makeURI(listURL));
|
||||
let chan = NetUtil.ioService.newChannelFromURI2(makeURI(listURL),
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let sis = Cc["@mozilla.org/scriptableinputstream;1"].
|
||||
createInstance(Ci.nsIScriptableInputStream);
|
||||
sis.init(chan.open());
|
||||
@ -4931,7 +4951,12 @@ var engineMetadataService = {
|
||||
if (jsonFile.exists()) {
|
||||
try {
|
||||
let uri = Services.io.newFileURI(jsonFile);
|
||||
let stream = Services.io.newChannelFromURI(uri).open();
|
||||
let stream = Services.io.newChannelFromURI2(uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).open();
|
||||
this._store = parseJsonFromStream(stream);
|
||||
} catch (x) {
|
||||
LOG("metadata syncInit: could not load JSON file " + x);
|
||||
|
@ -78,7 +78,12 @@ Protocol.prototype = {
|
||||
let {url} = parseURI(aURI);
|
||||
let file = PageThumbsStorage.getFilePathForURL(url);
|
||||
let fileuri = Services.io.newFileURI(new FileUtils.File(file));
|
||||
return Services.io.newChannelFromURI(fileuri);
|
||||
return Services.io.newChannelFromURI2(fileuri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -220,7 +220,12 @@ HashCompleterRequest.prototype = {
|
||||
Ci.nsIChannel.LOAD_BYPASS_CACHE;
|
||||
|
||||
let uri = Services.io.newURI(this.gethashUrl, null, null);
|
||||
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.loadFlags = loadFlags;
|
||||
|
||||
// Disable keepalive.
|
||||
|
@ -116,14 +116,21 @@ let ImageCropper = {
|
||||
|
||||
let ImageFile = {
|
||||
read: function ImageFile_read(aURI, aCallback) {
|
||||
this._netUtil.asyncFetch(aURI, function read_asyncFetch(aInputStream, aStatus, aRequest) {
|
||||
if (Components.isSuccessCode(aStatus) && aRequest instanceof Ci.nsIChannel) {
|
||||
let channel = aRequest.QueryInterface(Ci.nsIChannel);
|
||||
aCallback(aInputStream, channel.contentType);
|
||||
} else {
|
||||
aCallback();
|
||||
}
|
||||
});
|
||||
this._netUtil.asyncFetch2(
|
||||
aURI,
|
||||
function read_asyncFetch(aInputStream, aStatus, aRequest) {
|
||||
if (Components.isSuccessCode(aStatus) && aRequest instanceof Ci.nsIChannel) {
|
||||
let channel = aRequest.QueryInterface(Ci.nsIChannel);
|
||||
aCallback(aInputStream, channel.contentType);
|
||||
} else {
|
||||
aCallback();
|
||||
}
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_IMAGE);
|
||||
},
|
||||
|
||||
write: function ImageFile_write(aFile, aInputStream, aCallback) {
|
||||
|
@ -1929,7 +1929,12 @@ this.XPIProvider = {
|
||||
|
||||
let chan;
|
||||
try {
|
||||
chan = Services.io.newChannelFromURI(aURI);
|
||||
chan = Services.io.newChannelFromURI2(aURI,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
catch (ex) {
|
||||
return null;
|
||||
@ -5400,7 +5405,14 @@ AddonInstall.prototype = {
|
||||
let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true);
|
||||
this.badCertHandler = new BadCertHandler(!requireBuiltIn);
|
||||
|
||||
this.channel = NetUtil.newChannel(this.sourceURI);
|
||||
this.channel = NetUtil.newChannel2(this.sourceURI,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
this.channel.notificationCallbacks = this;
|
||||
if (this.channel instanceof Ci.nsIHttpChannel) {
|
||||
this.channel.setRequestHeader("Moz-XPI-Update", "1", true);
|
||||
|
@ -1362,7 +1362,14 @@ function getLocale() {
|
||||
return gLocale;
|
||||
|
||||
for (let res of ['app', 'gre']) {
|
||||
var channel = Services.io.newChannel("resource://" + res + "/" + FILE_UPDATE_LOCALE, null, null);
|
||||
var channel = Services.io.newChannel2("resource://" + res + "/" + FILE_UPDATE_LOCALE,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_DATAREQUEST);
|
||||
try {
|
||||
var inputStream = channel.open();
|
||||
gLocale = readStringFromInputStream(inputStream);
|
||||
|
Loading…
Reference in New Issue
Block a user