Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
1 'use strict';
3 const { Ci } = require('chrome');
4 const { openTab, closeTab } = require('sdk/tabs/utils');
5 const { browserWindows } = require('sdk/windows');
6 const { getOwnerWindow } = require('sdk/private-browsing/window/utils');
7 const { isPrivate } = require('sdk/private-browsing');
9 exports.testIsPrivateOnTab = function(assert) {
10 let window = browserWindows.activeWindow;
12 let chromeWindow = getOwnerWindow(window);
14 assert.ok(chromeWindow instanceof Ci.nsIDOMWindow, 'associated window is found');
15 assert.ok(!isPrivate(chromeWindow), 'the top level window is not private');
17 let rawTab = openTab(chromeWindow, 'data:text/html,<h1>Hi!</h1>', {
18 isPrivate: true
19 });
21 // test that the tab is private
22 assert.ok(rawTab.browser.docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing);
23 assert.ok(isPrivate(rawTab.browser.contentWindow));
24 assert.ok(isPrivate(rawTab.browser));
26 closeTab(rawTab);
27 };