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 Object.defineProperty(this, 'global', { value: this });
8 exports.testGlobals = function(assert) {
9 // the only globals in module scope should be:
10 // module, exports, require, dump, console
11 assert.equal(typeof module, 'object', 'have "module", good');
12 assert.equal(typeof exports, 'object', 'have "exports", good');
13 assert.equal(typeof require, 'function', 'have "require", good');
14 assert.equal(typeof dump, 'function', 'have "dump", good');
15 assert.equal(typeof console, 'object', 'have "console", good');
17 // in particular, these old globals should no longer be present
18 assert.ok(!('packaging' in global), "no 'packaging', good");
19 assert.ok(!('memory' in global), "no 'memory', good");
20 assert.ok(/test-globals\.js$/.test(module.uri),
21 'should contain filename');
22 };
24 exports.testComponent = function (assert) {
25 assert.throws(() => {
26 Components;
27 }, /`Components` is not available/, 'using `Components` throws');
28 };
30 require('test').run(exports);