Bug 1232786 - Convert JS tests to use open2 within devtools/ (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2016-01-13 19:35:41 -08:00
Родитель e5662ee73b
Коммит 9fe9a078ce
4 изменённых файлов: 23 добавлений и 40 удалений

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

@ -4,6 +4,8 @@
"use strict";
Cu.import("resource://gre/modules/NetUtil.jsm");
const { require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
const Editor = require("devtools/client/sourceeditor/editor");
const promise = require("promise");
@ -139,16 +141,11 @@ function read(url) {
let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
.getService(Ci.nsIScriptableInputStream);
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();
let channel = NetUtil.newChannel({
uri: url,
loadUsingSystemPrincipal: true
});
let input = channel.open2();
scriptableStream.init(input);
let data = "";

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

@ -65,18 +65,11 @@ function read(srcChromeURL) {
let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
.getService(Ci.nsIScriptableInputStream);
let channel = Services.io.newChannel2(srcChromeURL,
null,
null,
// aLoadingNode
null,
Services.scriptSecurityManager
.getSystemPrincipal(),
// aTriggeringPrincipal
null,
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
let channel = NetUtil.newChannel({
uri: srcChromeURL,
loadUsingSystemPrincipal: true
});
let input = channel.open2();
scriptableStream.init(input);
let data = "";

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

@ -127,15 +127,11 @@ function read(srcChromeURL) {
.getService(Ci.nsIScriptableInputStream);
let principal = Services.scriptSecurityManager.getSystemPrincipal();
let channel = Services.io.newChannel2(srcChromeURL,
null,
null,
null,
principal,
null,
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let input = channel.open();
let channel = NetUtil.newChannel({
uri: srcChromeURL,
loadUsingSystemPrincipal: true
});
let input = channel.open2();
scriptableStream.init(input);
let data = "";

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

@ -10,6 +10,7 @@ const { DebuggerClient } = require("devtools/shared/client/main");
const { DebuggerServer } = require("devtools/server/main");
const { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm");
const { Services } = Cu.import("resource://gre/modules/Services.jsm");
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm");
var gClient, gActor;
@ -83,15 +84,11 @@ function webappActorRequest(request, onResponse) {
function downloadURL(url, file) {
let channel = Services.io.newChannel2(url,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let istream = channel.open();
let channel = NetUtil.newChannel({
uri: url,
loadUsingSystemPrincipal: true
});
let istream = channel.open2();
let bstream = Cc["@mozilla.org/binaryinputstream;1"]
.createInstance(Ci.nsIBinaryInputStream);
bstream.setInputStream(istream);