Skip to content

Commit

Permalink
Backed out changeset 8bacae951c0c (bug 1246725)
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Feb 19, 2016
1 parent f2a9855 commit 5ab3a1f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
13 changes: 7 additions & 6 deletions addon-sdk/source/lib/sdk/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
14 changes: 9 additions & 5 deletions addon-sdk/source/test/test-private-browsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5ab3a1f

Please sign in to comment.