mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1230221 - Convert JS callsites to use asyncOpen2 within services/ (r=sicking)
This commit is contained in:
parent
14c7310db8
commit
e4a5ac45b4
@ -16,6 +16,7 @@ this.EXPORTED_SYMBOLS = [
|
|||||||
|
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Log.jsm");
|
Cu.import("resource://gre/modules/Log.jsm");
|
||||||
Cu.import("resource://services-common/utils.js");
|
Cu.import("resource://services-common/utils.js");
|
||||||
@ -305,14 +306,9 @@ RESTRequest.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create and initialize HTTP channel.
|
// Create and initialize HTTP channel.
|
||||||
let channel = Services.io.newChannelFromURI2(this.uri,
|
let channel = NetUtil.newChannel({uri: this.uri, loadUsingSystemPrincipal: true})
|
||||||
null, // aLoadingNode
|
.QueryInterface(Ci.nsIRequest)
|
||||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
.QueryInterface(Ci.nsIHttpChannel);
|
||||||
null, // aTriggeringPrincipal
|
|
||||||
Ci.nsILoadInfo.SEC_NORMAL,
|
|
||||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
|
||||||
.QueryInterface(Ci.nsIRequest)
|
|
||||||
.QueryInterface(Ci.nsIHttpChannel);
|
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
channel.loadFlags |= this.loadFlags;
|
channel.loadFlags |= this.loadFlags;
|
||||||
channel.notificationCallbacks = this;
|
channel.notificationCallbacks = this;
|
||||||
@ -358,7 +354,7 @@ RESTRequest.prototype = {
|
|||||||
|
|
||||||
// Blast off!
|
// Blast off!
|
||||||
try {
|
try {
|
||||||
channel.asyncOpen(this, null);
|
channel.asyncOpen2(this);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
|
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
|
||||||
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
|
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
|
||||||
|
@ -13,6 +13,7 @@ var Cr = Components.results;
|
|||||||
var Cu = Components.utils;
|
var Cu = Components.utils;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
|
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||||
Cu.import("resource://services-common/async.js");
|
Cu.import("resource://services-common/async.js");
|
||||||
Cu.import("resource://gre/modules/Log.jsm");
|
Cu.import("resource://gre/modules/Log.jsm");
|
||||||
Cu.import("resource://services-common/observers.js");
|
Cu.import("resource://services-common/observers.js");
|
||||||
@ -148,16 +149,9 @@ AsyncResource.prototype = {
|
|||||||
// to obtain a request channel.
|
// to obtain a request channel.
|
||||||
//
|
//
|
||||||
_createRequest: function Res__createRequest(method) {
|
_createRequest: function Res__createRequest(method) {
|
||||||
let channel = Services.io.newChannel2(this.spec,
|
let channel = NetUtil.newChannel({uri: this.spec, loadUsingSystemPrincipal: true})
|
||||||
null,
|
.QueryInterface(Ci.nsIRequest)
|
||||||
null,
|
.QueryInterface(Ci.nsIHttpChannel);
|
||||||
null, // aLoadingNode
|
|
||||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
|
||||||
null, // aTriggeringPrincipal
|
|
||||||
Ci.nsILoadInfo.SEC_NORMAL,
|
|
||||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
|
||||||
.QueryInterface(Ci.nsIRequest)
|
|
||||||
.QueryInterface(Ci.nsIHttpChannel);
|
|
||||||
|
|
||||||
channel.loadFlags |= DEFAULT_LOAD_FLAGS;
|
channel.loadFlags |= DEFAULT_LOAD_FLAGS;
|
||||||
|
|
||||||
@ -230,9 +224,9 @@ AsyncResource.prototype = {
|
|||||||
this._log, this.ABORT_TIMEOUT);
|
this._log, this.ABORT_TIMEOUT);
|
||||||
channel.requestMethod = action;
|
channel.requestMethod = action;
|
||||||
try {
|
try {
|
||||||
channel.asyncOpen(listener, null);
|
channel.asyncOpen2(listener);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// asyncOpen can throw in a bunch of cases -- e.g., a forbidden port.
|
// asyncOpen2 can throw in a bunch of cases -- e.g., a forbidden port.
|
||||||
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
|
this._log.warn("Caught an error in asyncOpen: " + CommonUtils.exceptionStr(ex));
|
||||||
CommonUtils.nextTick(callback.bind(this, ex));
|
CommonUtils.nextTick(callback.bind(this, ex));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user