40 ok(PlacesUtils,
"checking PlacesUtils, running in chrome context?");
41 ok(
PlacesUIUtils,
"checking PlacesUIUtils, running in chrome context?");
58 var toolbarId = PlacesUtils.toolbarFolderId;
59 var toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
61 var oldCount = toolbarNode.childCount;
62 var testRootId = PlacesUtils.bookmarks.createFolder(toolbarId,
"test root", -1);
63 is(toolbarNode.childCount, oldCount+1,
"confirm test root node is a container, and is empty");
64 var testRootNode = toolbarNode.getChild(toolbarNode.childCount-1);
65 testRootNode.QueryInterface(
Ci.nsINavHistoryContainerResultNode);
66 testRootNode.containerOpen =
true;
67 is(testRootNode.childCount, 0,
"confirm test root node is a container, and is empty");
70 var folderAId = PlacesUtils.bookmarks.createFolder(testRootId,
"A", -1);
72 var folderANode = PlacesUtils.getFolderContents(folderAId).root;
74 is(testRootNode.childCount, 1,
"create test folder");
77 var serializedNode = PlacesUtils.wrapNode(folderANode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER);
78 var rawNode = PlacesUtils.unwrapNodes(serializedNode, PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER).shift();
80 ok(rawNode.type,
"confirm json node");
82 PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
86 ok(transaction,
"create transaction");
89 is(testRootNode.childCount, 2,
"create test folder via copy");
92 var folderBNode = testRootNode.getChild(1);
97 is(testRootNode.childCount, 1,
"confirm undo removed the copied folder");
101 is(testRootNode.childCount, 2,
"confirm redo re-copied the folder");
102 folderBNode = testRootNode.getChild(1);
106 testRootNode.containerOpen =
false;
107 toolbarNode.containerOpen =
false;
111 PlacesUtils.bookmarks.removeItem(folderAId);
115 var folderId = PlacesUtils.bookmarks.createFolder(aFolderId,
"test folder", -1);
116 PlacesUtils.bookmarks.insertBookmark(folderId, PlacesUtils._uri(
"http://foo"), -1,
"test bookmark");
117 PlacesUtils.bookmarks.insertSeparator(folderId, -1);
122 aNode.containerOpen =
true;
123 is(aNode.childCount, 1,
"confirm child count match");
124 var folderNode = aNode.getChild(0);
125 is(folderNode.title,
"test folder",
"confirm folder title");
127 folderNode.containerOpen =
true;
128 is(folderNode.childCount, 2,
"confirm child count match");
129 var bookmarkNode = folderNode.getChild(0);
130 var separatorNode = folderNode.getChild(1);
131 folderNode.containerOpen =
false;
132 aNode.containerOpen =
false;
function populate(aFolderId)
function asContainer(aNode)