Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
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 };