Bug 1138650 - Update remaining callsites to use newChannel2 in toolkit/devtools (r=jryans)

This commit is contained in:
Christoph Kerschbaumer 2015-03-09 20:05:49 -07:00
parent 1cd6810693
commit c4009158f9
2 changed files with 24 additions and 3 deletions

View File

@ -492,12 +492,26 @@ exports.fetch = function fetch(aURL, aOptions={ loadFromCache: true }) {
default:
let channel;
try {
channel = Services.io.newChannel(url, null, null);
channel = Services.io.newChannel2(url,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
} catch (e if e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {
// On Windows xpcshell tests, c:/foo/bar can pass as a valid URL, but
// newChannel won't be able to handle it.
url = "file:///" + url;
channel = Services.io.newChannel(url, null, null);
channel = Services.io.newChannel2(url,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
}
let chunks = [];
let streamListener = {

View File

@ -23,7 +23,14 @@ exports.unregister = function(handle) {
};
function getDefaultSettings() {
let chan = NetUtil.newChannel(settingsFile);
let chan = NetUtil.newChannel2(settingsFile,
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = chan.open();
// Obtain a converter to read from a UTF-8 encoded input stream.
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]