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 { setTimeout } = require('sdk/timers');
8 let mainStarted = false;
10 exports.main = function main(options, callbacks) {
11 mainStarted = true;
13 let tests = {};
15 tests.testMainArguments = function(assert) {
16 assert.ok(!!options, 'options argument provided to main');
17 assert.ok('loadReason' in options, 'loadReason is in options provided by main');
18 assert.equal(typeof callbacks.print, 'function', 'callbacks.print is a function');
19 assert.equal(typeof callbacks.quit, 'function', 'callbacks.quit is a function');
20 assert.equal(options.loadReason, 'install', 'options.loadReason is install');
21 }
23 require('sdk/test/runner').runTestsFromModule({exports: tests});
24 }
26 // this causes a fail if main does not start
27 setTimeout(function() {
28 if (mainStarted)
29 return;
31 // main didn't start, fail..
32 require("sdk/test/runner").runTestsFromModule({exports: {
33 testFail: function(assert) assert.fail('Main did not start..')
34 }});
35 }, 500);