mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1087741: Make JS callers of ios.newChannel call ios.newChannel2 in services/ (r=rnewman,hskupin)
This commit is contained in:
parent
0b69ea4cff
commit
7d268b217e
@ -305,7 +305,12 @@ RESTRequest.prototype = {
|
||||
}
|
||||
|
||||
// Create and initialize HTTP channel.
|
||||
let channel = Services.io.newChannelFromURI(this.uri, null, null)
|
||||
let channel = Services.io.newChannelFromURI2(this.uri,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIRequest)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
this.channel = channel;
|
||||
|
@ -180,7 +180,12 @@ AboutWeaveLog.prototype = {
|
||||
newChannel: function(aURI) {
|
||||
let dir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
|
||||
let uri = Services.io.newFileURI(dir);
|
||||
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.originalURI = aURI;
|
||||
|
||||
// Ensure that the about page has the same privileges as a regular directory
|
||||
|
@ -146,7 +146,14 @@ AsyncResource.prototype = {
|
||||
// to obtain a request channel.
|
||||
//
|
||||
_createRequest: function Res__createRequest(method) {
|
||||
let channel = Services.io.newChannel(this.spec, null, null)
|
||||
let channel = Services.io.newChannel2(this.spec,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER)
|
||||
.QueryInterface(Ci.nsIRequest)
|
||||
.QueryInterface(Ci.nsIHttpChannel);
|
||||
|
||||
|
@ -7,6 +7,7 @@ Cu.import("resource://services-sync/service.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
|
||||
const LOG_PREFIX_SUCCESS = "success-";
|
||||
@ -81,11 +82,16 @@ add_test(function test_logOnSuccess_false() {
|
||||
});
|
||||
|
||||
function readFile(file, callback) {
|
||||
NetUtil.asyncFetch(file, function (inputStream, statusCode, request) {
|
||||
NetUtil.asyncFetch2(file, function (inputStream, statusCode, request) {
|
||||
let data = NetUtil.readInputStreamToString(inputStream,
|
||||
inputStream.available());
|
||||
callback(statusCode, data);
|
||||
});
|
||||
},
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
}
|
||||
|
||||
add_test(function test_logOnSuccess_true() {
|
||||
|
@ -20,7 +20,14 @@ const STATE_ENABLED = 1;
|
||||
const STATE_DISABLED = 2;
|
||||
|
||||
function GetFileAsText(file) {
|
||||
let channel = Services.io.newChannel(file, null, null);
|
||||
let channel = Services.io.newChannel2(file,
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
let inputStream = channel.open();
|
||||
if (channel instanceof Ci.nsIHttpChannel &&
|
||||
channel.responseStatus != 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user