addon-sdk/test/browser_sdk_loader_json.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 function test () {
     2   let loader = makeLoader();
     3   let module = Module("./main", gTestPath);
     4   let require = Require(loader, module);
     6   /*
     7    * Relative resource:// URI of json
     8    */
    10   let data = require("./data.json");
    11   is(data.title, "jetpack mochitests", "loads relative JSON");
    12   is(data.dependencies.underscore, "1.0.0", "loads relative JSON");
    14   try {
    15     let data = require("./invalid.json");
    16     ok(false, "parsing an invalid JSON should throw");
    17   }
    18   catch (e) {
    19     ok(e, "parsing an invalid JSON should throw");
    20   }
    22   finish();
    23 }

mercurial