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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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