addon-sdk/source/test/test-set-exports.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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

mercurial