mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1115193 - Make JS callers of ios.newChannel call ios.newChannel2 in browser/devtools - tests (r=vporof)
This commit is contained in:
parent
1479747bf7
commit
95f1e859d8
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user