Use asyncOpen2 instead of asyncOpen everywhere in Pale Moon

This commit is contained in:
JustOff 2018-04-17 23:16:20 +03:00 • committed by Roy Tam
commit 3df5e55320
3 changed files with 19 additions and 26 deletions

View file

@ -260,7 +260,7 @@ FeedConverter.prototype = {
} }
chromeChannel.loadGroup = this._request.loadGroup; chromeChannel.loadGroup = this._request.loadGroup;
chromeChannel.asyncOpen(this._listener, null); chromeChannel.asyncOpen2(this._listener);
} }
finally { finally {
this._releaseHandles(); this._releaseHandles();

View file

@ -9,6 +9,7 @@ const Cr = Components.results;
const Cu = Components.utils; const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}"); const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}");
const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1"; const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
@ -1137,16 +1138,14 @@ FeedWriter.prototype = {
var nullPrincipal = Cc["@mozilla.org/nullprincipal;1"]. var nullPrincipal = Cc["@mozilla.org/nullprincipal;1"].
createInstance(Ci.nsIPrincipal); createInstance(Ci.nsIPrincipal);
var resolvedURI = Cc["@mozilla.org/network/io-service;1"]. // this channel is not going to be openend, use a nullPrincipal
getService(Ci.nsIIOService). // and the most restrctive securityFlag.
newChannel2("about:feeds", let resolvedURI = NetUtil.newChannel({
null, uri: "about:feeds",
null, loadingPrincipal: nullPrincipal,
null, // aLoadingNode securityFlags: Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
nullPrincipal, contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER
null, // aTriggeringPrincipal }).URI;
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER).URI;
if (resolvedURI.equals(chan.URI)) if (resolvedURI.equals(chan.URI))
return chan.originalURI; return chan.originalURI;

View file

@ -1931,12 +1931,10 @@ this.XPIProvider = {
let chan; let chan;
try { try {
chan = Services.io.newChannelFromURI2(aURI, chan = NetUtil.newChannel({
null, // aLoadingNode uri: aURI,
Services.scriptSecurityManager.getSystemPrincipal(), loadUsingSystemPrincipal: true
null, // aTriggeringPrincipal });
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
} }
catch (ex) { catch (ex) {
return null; return null;
@ -5456,21 +5454,17 @@ AddonInstall.prototype = {
let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true); let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true);
this.badCertHandler = new BadCertHandler(!requireBuiltIn); this.badCertHandler = new BadCertHandler(!requireBuiltIn);
this.channel = NetUtil.newChannel2(this.sourceURI, this.channel = NetUtil.newChannel({
null, uri: this.sourceURI,
null, loadUsingSystemPrincipal: true
null, // aLoadingNode });
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
this.channel.notificationCallbacks = this; this.channel.notificationCallbacks = this;
if (this.channel instanceof Ci.nsIHttpChannel) { if (this.channel instanceof Ci.nsIHttpChannel) {
this.channel.setRequestHeader("Moz-XPI-Update", "1", true); this.channel.setRequestHeader("Moz-XPI-Update", "1", true);
if (this.channel instanceof Ci.nsIHttpChannelInternal) if (this.channel instanceof Ci.nsIHttpChannelInternal)
this.channel.forceAllowThirdPartyCookie = true; this.channel.forceAllowThirdPartyCookie = true;
} }
this.channel.asyncOpen(listener, null); this.channel.asyncOpen2(listener);
Services.obs.addObserver(this, "network:offline-about-to-go-offline", false); Services.obs.addObserver(this, "network:offline-about-to-go-offline", false);
} }