Bug 1115193 - Make JS callers of ios.newChannel call ios.newChannel2 in browser/devtools - tests (r=vporof)

This commit is contained in:
Christoph Kerschbaumer 2015-02-10 20:49:06 -08:00
parent b413c219d6
commit 299cd5d9be
6 changed files with 49 additions and 9 deletions

View File

@ -260,7 +260,7 @@ function* getFileData(file) {
}
let def = promise.defer();
NetUtil.asyncFetch(file, function(inputStream, status) {
NetUtil.asyncFetch2(file, function(inputStream, status) {
if (!Components.isSuccessCode(status)) {
info("ERROR READING TEMP FILE", status);
}
@ -275,7 +275,12 @@ function* getFileData(file) {
var data = NetUtil.readInputStreamToString(inputStream, inputStream.available());
def.resolve(data);
});
},
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
return def.promise;
}

View File

@ -214,10 +214,17 @@ function writeFile(file, content, callback)
function readFile(file, callback)
{
let channel = NetUtil.newChannel(file);
let channel = NetUtil.newChannel2(file,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.contentType = "application/javascript";
NetUtil.asyncFetch(channel, function(inputStream, status) {
NetUtil.asyncFetch2(channel, function(inputStream, status) {
ok(Components.isSuccessCode(status),
"file was read successfully");

View File

@ -91,11 +91,18 @@ function fileExported(aStatus)
gFileContent = oldContent;
let channel = NetUtil.newChannel(gFile);
let channel = NetUtil.newChannel2(gFile,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.contentType = "application/javascript";
// Read back the temporary file.
NetUtil.asyncFetch(channel, fileRead);
NetUtil.asyncFetch2(channel, fileRead);
}
function fileExported2()

View File

@ -87,7 +87,14 @@ function read(url) {
let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
.getService(Ci.nsIScriptableInputStream);
let channel = Services.io.newChannel(url, null, null);
let channel = Services.io.newChannel2(url,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
scriptableStream.init(input);

View File

@ -65,7 +65,14 @@ function read(aSrcChromeURL)
let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
.getService(Ci.nsIScriptableInputStream);
let channel = Services.io.newChannel(aSrcChromeURL, null, null);
let channel = Services.io.newChannel2(aSrcChromeURL,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
scriptableStream.init(input);

View File

@ -150,7 +150,14 @@ function read(aSrcChromeURL)
let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
.getService(Ci.nsIScriptableInputStream);
let channel = Services.io.newChannel(aSrcChromeURL, null, null);
let channel = Services.io.newChannel2(aSrcChromeURL,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
scriptableStream.init(input);