Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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 };