toolkit/components/places/tests/unit/test_history_catobs.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 /* 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 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     7 // Get services.
     8 let os = Cc["@mozilla.org/observer-service;1"].
     9          getService(Ci.nsIObserverService);
    11 let gDummyCreated = false;
    12 let gDummyVisited = false;
    14 let observer = {
    15   observe: function(subject, topic, data) {
    16     if (topic == "dummy-observer-created")
    17       gDummyCreated = true;
    18     else if (topic == "dummy-observer-visited")
    19       gDummyVisited = true;
    20   },
    22   QueryInterface: XPCOMUtils.generateQI([
    23     Ci.nsIObserver,
    24     Ci.nsISupportsWeakReference,
    25   ])
    26 };
    28 function verify() {
    29   do_check_true(gDummyCreated);
    30   do_check_true(gDummyVisited);
    31   do_test_finished();
    32 }
    34 // main
    35 function run_test() {
    36   do_load_manifest("nsDummyObserver.manifest");
    38   os.addObserver(observer, "dummy-observer-created", true);
    39   os.addObserver(observer, "dummy-observer-visited", true);
    41   do_test_pending();
    43   // Add a visit
    44   promiseAddVisits(uri("http://typed.mozilla.org")).then(
    45             function () do_timeout(1000, verify));
    46 }

mercurial