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"]
.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) {
try {
@ -66,11 +66,12 @@ var toFilename = exports.toFilename = function toFilename(url) {
if (uri.scheme == "resource")
uri = newURI(resolveResourceURI(uri));
if (uri.scheme == "chrome") {
var channel = NetUtil.newChannel({
uri: uri,
loadUsingSystemPrincipal: true
});
var channel = ios.newChannelFromURI2(uri,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
try {
channel = channel.QueryInterface(Ci.nsIFileChannel);
return channel.file.path;

View File

@ -17,7 +17,7 @@ const { getMode, isWindowPBSupported, isTabPBSupported } = require('sdk/private-
const { pb } = require('./private-browsing/helper');
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";
@ -66,10 +66,14 @@ exports.testIsPrivateBrowsingFalseDefault = function(assert) {
};
exports.testNSIPrivateBrowsingChannel = function(assert) {
let channel = NetUtil.newChannel({
uri: "about:blank",
loadUsingSystemPrincipal: true
});
let channel = Services.io.newChannel2("about:blank",
null,
null,
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Ci.nsILoadInfo.SEC_NORMAL,
Ci.nsIContentPolicy.TYPE_OTHER);
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
assert.equal(isPrivate(channel), false, 'isPrivate detects non-private channels');
channel.setPrivate(true);