toolkit/components/places/tests/bookmarks/test_protectRoots.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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