Backed out changeset 8bacae951c0c (bug 1246725)

This commit is contained in:
Carsten "Tomcat" Book 2016-02-19 15:55:24 +01:00
parent 1990919b33
commit 7ebb137164
2 changed files with 16 additions and 11 deletions

View File

@ -23,7 +23,7 @@ var resProt = ios.getProtocolHandler("resource")
var URLParser = Cc["@mozilla.org/network/url-parser;1?auth=no"] var URLParser = Cc["@mozilla.org/network/url-parser;1?auth=no"]
.getService(Ci.nsIURLParser); .getService(Ci.nsIURLParser);
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm"); const { Services } = Cu.import("resource://gre/modules/Services.jsm");
function newURI(uriStr, base) { function newURI(uriStr, base) {
try { try {
@ -66,11 +66,12 @@ var toFilename = exports.toFilename = function toFilename(url) {
if (uri.scheme == "resource") if (uri.scheme == "resource")
uri = newURI(resolveResourceURI(uri)); uri = newURI(resolveResourceURI(uri));
if (uri.scheme == "chrome") { if (uri.scheme == "chrome") {
var channel = NetUtil.newChannel({ var channel = ios.newChannelFromURI2(uri,
uri: uri, null, // aLoadingNode
loadUsingSystemPrincipal: true Services.scriptSecurityManager.getSystemPrincipal(),
}); null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
try { try {
channel = channel.QueryInterface(Ci.nsIFileChannel); channel = channel.QueryInterface(Ci.nsIFileChannel);
return channel.file.path; return channel.file.path;

View File

@ -17,7 +17,7 @@ const { getMode, isWindowPBSupported, isTabPBSupported } = require('sdk/private-
const { pb } = require('./private-browsing/helper'); const { pb } = require('./private-browsing/helper');
const prefs = require('sdk/preferences/service'); const prefs = require('sdk/preferences/service');
const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {}); const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const kAutoStartPref = "browser.privatebrowsing.autostart"; const kAutoStartPref = "browser.privatebrowsing.autostart";
@ -66,10 +66,14 @@ exports.testIsPrivateBrowsingFalseDefault = function(assert) {
}; };
exports.testNSIPrivateBrowsingChannel = function(assert) { exports.testNSIPrivateBrowsingChannel = function(assert) {
let channel = NetUtil.newChannel({ let channel = Services.io.newChannel2("about:blank",
uri: "about:blank", null,
loadUsingSystemPrincipal: true null,
}); null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel); channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
assert.equal(isPrivate(channel), false, 'isPrivate detects non-private channels'); assert.equal(isPrivate(channel), false, 'isPrivate detects non-private channels');
channel.setPrivate(true); channel.setPrivate(true);