Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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 };