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.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | let four = require("./modules/exportsEquals"); |
michael@0 | 6 | exports.testExportsEquals = function(assert) { |
michael@0 | 7 | assert.equal(four, 4); |
michael@0 | 8 | }; |
michael@0 | 9 | |
michael@0 | 10 | /* TODO: Discuss idea of dropping support for this feature that was alternative |
michael@0 | 11 | to `module.exports = ..` that failed. |
michael@0 | 12 | let five = require("./modules/setExports"); |
michael@0 | 13 | exports.testSetExports = function(assert) { |
michael@0 | 14 | assert.equal(five, 5); |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | exports.testDupeSetExports = function(assert) { |
michael@0 | 18 | var passed = false; |
michael@0 | 19 | try { |
michael@0 | 20 | var dupe = require('./modules/dupeSetExports'); |
michael@0 | 21 | } catch(e) { |
michael@0 | 22 | passed = /define\(\) was used, so module\.exports= and module\.setExports\(\) may not be used/.test(e.toString()); |
michael@0 | 23 | } |
michael@0 | 24 | assert.equal(passed, true, 'define() or setExports(), not both'); |
michael@0 | 25 | } |
michael@0 | 26 | */ |
michael@0 | 27 | |
michael@0 | 28 | exports.testModule = function(assert) { |
michael@0 | 29 | // module.id is not cast in stone yet. In the future, it may include the |
michael@0 | 30 | // package name, or may possibly be a/ URL of some sort. For now, it's a |
michael@0 | 31 | // URL that starts with resource: and ends with this module name, but the |
michael@0 | 32 | // part in between varies depending upon how the test is run. |
michael@0 | 33 | var found = /test-set-exports$/.test(module.id); |
michael@0 | 34 | assert.equal(found, true, module.id+" ends with test-set-exports.js"); |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | require('sdk/test').run(exports); |