|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function run_test() |
|
5 { |
|
6 const ROOTS = [ |
|
7 PlacesUtils.bookmarksMenuFolderId, |
|
8 PlacesUtils.toolbarFolderId, |
|
9 PlacesUtils.unfiledBookmarksFolderId, |
|
10 PlacesUtils.tagsFolderId, |
|
11 PlacesUtils.placesRootId |
|
12 ]; |
|
13 |
|
14 for (let root of ROOTS) { |
|
15 do_check_true(PlacesUtils.isRootItem(root)); |
|
16 |
|
17 try { |
|
18 PlacesUtils.bookmarks.removeItem(root); |
|
19 do_throw("Trying to remove a root should throw"); |
|
20 } catch (ex) {} |
|
21 |
|
22 try { |
|
23 PlacesUtils.bookmarks.moveItem(root, PlacesUtils.placesRootId, 0); |
|
24 do_throw("Trying to move a root should throw"); |
|
25 } catch (ex) {} |
|
26 |
|
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 } |