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
Родитель 1479747bf7
Коммит 95f1e859d8
6 изменённых файлов: 49 добавлений и 9 удалений

Просмотреть файл

@ -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);