toolkit/components/places/tests/unit/test_bookmark_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 bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
     9          getService(Ci.nsINavBookmarksService);
    10 let os = Cc["@mozilla.org/observer-service;1"].
    11          getService(Ci.nsIObserverService);
    13 let gDummyCreated = false;
    14 let gDummyAdded = false;
    16 let observer = {
    17   observe: function(subject, topic, data) {
    18     if (topic == "dummy-observer-created")
    19       gDummyCreated = true;
    20     else if (topic == "dummy-observer-item-added")
    21       gDummyAdded = true;
    22   },
    24   QueryInterface: XPCOMUtils.generateQI([
    25     Ci.nsIObserver,
    26     Ci.nsISupportsWeakReference,
    27   ])
    28 };
    30 function verify() {
    31   do_check_true(gDummyCreated);
    32   do_check_true(gDummyAdded);
    33   do_test_finished();
    34 }
    36 // main
    37 function run_test() {
    38   do_load_manifest("nsDummyObserver.manifest");
    40   os.addObserver(observer, "dummy-observer-created", true);
    41   os.addObserver(observer, "dummy-observer-item-added", true);
    43   // Add a bookmark
    44   bs.insertBookmark(bs.unfiledBookmarksFolder, uri("http://typed.mozilla.org"),
    45                     bs.DEFAULT_INDEX, "bookmark");
    47   do_test_pending();
    48   do_timeout(1000, verify);
    49 }

mercurial