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 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 'use strict';
6 const { Cc, Ci } = require('chrome');
7 const { setTimeout } = require('sdk/timers');
8 const { Loader } = require('sdk/test/loader');
9 const WM = Cc['@mozilla.org/appshell/window-mediator;1'].
10 getService(Ci.nsIWindowMediator);
11 const { browserWindows } = require('sdk/windows');
13 const ERR_MSG = 'This method is not yet supported by Fennec, consider using require("sdk/tabs") instead';
15 // TEST: browserWindows.length for Fennec
16 exports.testBrowserWindowsLength = function(assert) {
17 assert.equal(browserWindows.length, 1, "Only one window open");
18 };
20 // TEST: open & close window
21 exports.testOpenWindow = function(assert) {
22 let tabCount = browserWindows.activeWindow.tabs.length;
23 let url = "data:text/html;charset=utf-8,<title>windows%20API%20test</title>";
25 try {
26 browserWindows.open({url: url});
27 assert.fail('Error was not thrown');
28 }
29 catch(e) {
30 assert.equal(e.message, ERR_MSG, 'Error is thrown on windows.open');
31 assert.equal(browserWindows.length, 1, "Only one window open");
32 }
33 };
35 exports.testCloseWindow = function(assert) {
36 let window = browserWindows.activeWindow;
38 try {
39 window.close();
40 assert.fail('Error was not thrown');
41 }
42 catch(e) {
43 assert.equal(e.message, ERR_MSG, 'Error is thrown on windows.close');
44 assert.equal(browserWindows.length, 1, "Only one window open");
45 }
46 };
48 require('sdk/test').run(exports);