toolkit/components/places/tests/bookmarks/test_protectRoots.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function run_test()
     5 {
     6   const ROOTS = [
     7     PlacesUtils.bookmarksMenuFolderId,
     8     PlacesUtils.toolbarFolderId,
     9     PlacesUtils.unfiledBookmarksFolderId,
    10     PlacesUtils.tagsFolderId,
    11     PlacesUtils.placesRootId
    12   ];
    14   for (let root of ROOTS) {
    15     do_check_true(PlacesUtils.isRootItem(root));
    17     try {
    18       PlacesUtils.bookmarks.removeItem(root);
    19       do_throw("Trying to remove a root should throw");
    20     } catch (ex) {}
    22     try {
    23       PlacesUtils.bookmarks.moveItem(root, PlacesUtils.placesRootId, 0);
    24       do_throw("Trying to move a root should throw");
    25     } catch (ex) {}
    27     try {
    28       PlacesUtils.bookmarks.removeFolderChildren(root);
    29       if (root == PlacesUtils.placesRootId)
    30         do_throw("Trying to remove children of the main root should throw");
    31     } catch (ex) {
    32       if (root != PlacesUtils.placesRootId)
    33         do_throw("Trying to remove children of other roots should not throw");
    34     }
    35   }
    36 }

mercurial