addon-sdk/test/browser_sdk_loader_chrome.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   const { Ci, Cc, Cu, components } = require("chrome");
     8   let { generateUUID } = Cc["@mozilla.org/uuid-generator;1"]
     9                          .getService(Ci.nsIUUIDGenerator);
    10   ok(isUUID(generateUUID()), "chrome.Cc and chrome.Ci works");
    12   let { ID: parseUUID } = components;
    13   let uuidString = "00001111-2222-3333-4444-555566667777";
    14   let parsed = parseUUID(uuidString);
    15   is(parsed, "{" + uuidString + "}", "chrome.components works");
    17   const { defer } = Cu.import("resource://gre/modules/Promise.jsm").Promise;
    18   let { promise, resolve } = defer();
    19   resolve(5);
    20   promise.then(val => {
    21     is(val, 5, "chrome.Cu works");
    22     finish();
    23   });
    24 }

mercurial