Bug 1239913 - Convert toolkit/ to use asyncOpen2 where loadingPrincipal is SystemPrincipal (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2016-01-20 12:42:09 -08:00
parent c37a18ec34
commit eb33d87f83
2 changed files with 9 additions and 10 deletions

View File

@ -1984,7 +1984,7 @@ this.DownloadCopySaver.prototype = {
// Open the channel, directing output to the background file saver.
backgroundFileSaver.QueryInterface(Ci.nsIStreamListener);
channel.asyncOpen({
channel.asyncOpen2({
onStartRequest: function (aRequest, aContext) {
backgroundFileSaver.onStartRequest(aRequest, aContext);
@ -2086,7 +2086,7 @@ this.DownloadCopySaver.prototype = {
aInputStream, aOffset,
aCount);
}.bind(copySaver),
}, null);
});
// We should check if we have been canceled in the meantime, after
// all the previous asynchronous operations have been executed and

View File

@ -27,6 +27,8 @@ const BACKOFF_MAX = 8 * 60 * 60 * 1000;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
// Log only if browser.safebrowsing.debug is true
function log(...stuff) {
@ -236,13 +238,10 @@ HashCompleterRequest.prototype = {
let loadFlags = Ci.nsIChannel.INHIBIT_CACHING |
Ci.nsIChannel.LOAD_BYPASS_CACHE;
let uri = Services.io.newURI(this.gethashUrl, null, null);
let channel = Services.io.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let channel = NetUtil.newChannel({
uri: this.gethashUrl,
loadUsingSystemPrincipal: true
});
channel.loadFlags = loadFlags;
// Disable keepalive.
@ -261,7 +260,7 @@ HashCompleterRequest.prototype = {
let timeout = Services.prefs.getIntPref(
"urlclassifier.gethash.timeout_ms");
this.timer_.initWithCallback(this, timeout, this.timer_.TYPE_ONE_SHOT);
channel.asyncOpen(this, null);
channel.asyncOpen2(this);
},
// Returns a string for the request body based on the contents of