    try { bmsvc.insertSeparator(root, 1); bmsvc.removeChildAt(root, 1); } catch(ex) { do_throw("insertSeparator: " + ex); }   var newId7 = bmsvc.insertItem(root, uri("http: do_check_eq(bmsvc.indexOfItem(root, uri("http: bmsvc.removeItem(newId7);   var tmpFolder = bmsvc.createFolder(root, "tmp", 2); do_check_eq(bmsvc.indexOfFolder(root, tmpFolder), 2);   var kwTestItemId = bmsvc.insertItem(root, uri("http: try { var res = bmsvc.setKeywordForBookmark(kwTestItemId, "bar"); } catch(ex) { do_throw("setKeywordForBookmark: " + ex); }   var k = bmsvc.getKeywordForBookmark(kwTestItemId); do_check_eq("bar", k);   var k = bmsvc.getKeywordForURI(uri("http: do_check_eq("bar", k);   var u = bmsvc.getURIForKeyword("bar"); do_check_eq("http:   var newId8 = bmsvc.insertItem(root, uri("http: var b = bmsvc.getBookmarkIdsForURI(uri("http: do_check_eq(b[0], newId8);    var tmpFolder = bmsvc.createFolder(root, "removeFolderChildren", bmsvc.DEFAULT_INDEX); bmsvc.insertItem(tmpFolder, uri("http: bmsvc.createFolder(tmpFolder, "subfolder", bmsvc.DEFAULT_INDEX); bmsvc.insertSeparator(tmpFolder, bmsvc.DEFAULT_INDEX);  try { var options = histsvc.getNewQueryOptions(); options.maxResults = 1; options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1); var query = histsvc.getNewQuery(); query.setFolders([tmpFolder], 1); var result = histsvc.executeQuery(query, options); var rootNode = result.root; rootNode.containerOpen = true; do_check_eq(rootNode.childCount, 3); rootNode.containerOpen = false; } catch(ex) { do_throw("removeFolderChildren(): " + ex); }  bmsvc.removeFolderChildren(tmpFolder);  try { result = histsvc.executeQuery(query, options); var rootNode = result.root; rootNode.containerOpen = true; do_check_eq(rootNode.childCount, 0); rootNode.containerOpen = false; } catch(ex) { do_throw("removeFolderChildren(): " + ex); }   var newId9 = bmsvc.insertItem(root, uri("http: var placeURI = bmsvc.getItemURI(newId9); do_check_eq(placeURI.spec, "place:moz_bookmarks.id=" + newId9 + "&group=3");     try { var options = histsvc.getNewQueryOptions(); options.maxResults = 1; options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1); var query = histsvc.getNewQuery(); query.setFolders([root], 1); var result = histsvc.executeQuery(query, options); var rootNode = result.root; rootNode.containerOpen = true; var cc = rootNode.childCount; for (var i=0; i < cc; ++i) { var node = rootNode.getChild(i); do_check_true(node.bookmarkId > 0); } root.containerOpen = false; } catch(ex) { do_throw("bookmarks query: " + ex); }  /* test that multiple bookmarks with same URI show up in queries try {  var mURI = uri("http:   bmsvc.insertItem(root, mURI, bmsvc.DEFAULT_INDEX); bmsvc.insertItem(root, mURI, bmsvc.DEFAULT_INDEX);   var options = histsvc.getNewQueryOptions(); options.maxResults = 2; options.setGroupingMode([Ci.nsINavHistoryQueryOptions.GROUP_BY_FOLDER], 1); var query = histsvc.getNewQuery(); query.setFolders([root], 1); query.uri = mURI; var result = histsvc.executeQuery(query, options); var rootNode = result.root; rootNode.containerOpen = true; var cc = rootNode.childCount; do_check_eq(cc, 2); root.containerOpen = false; } catch(ex) { do_throw("bookmarks query: " + ex); } */   var newId10 = bmsvc.insertItem(root, uri("http: bmsvc.changeBookmarkURI(newId10, uri("http: do_check_eq(observer._itemChangedId, newId10); do_check_eq(observer._itemChanged.spec, "http: do_check_eq(observer._itemChangedProperty, "uri"); do_check_eq(observer._itemChangedValue, "");  var newId11 = bmsvc.insertItem(root, uri("http: var bmURI = bmsvc.getBookmarkURI(newId11); do_check_eq("http:  var newId12 = bmsvc.insertItem(root, uri("http: var bmIndex = bmsvc.getItemIndex(newId12); do_check_eq(1, bmIndex); 
function run_test() {  // insert item  bmsvc.insertItem(root, uri("http://google.com/"), -1);  do_check_eq(observer._itemAdded.spec, "http://google.com/");  do_check_eq(observer._itemAddedFolder, root);  do_check_eq(observer._itemAddedIndex, bmStartIndex);  // change item  bmsvc.setItemTitle(uri("http://google.com/"), "Google");  do_check_eq(observer._itemChanged.spec, "http://google.com/");  do_check_eq(observer._itemChangedProperty, "title");  // create folder  var workFolder = bmsvc.createFolder(root, "Work", 3);  do_check_eq(observer._folderAdded, workFolder);  do_check_eq(observer._folderAddedParent, root);  do_check_eq(observer._folderAddedIndex, 3);  // insert item  bmsvc.insertItem(workFolder, uri("http://developer.mozilla.org/"), 0);  do_check_eq(observer._itemAdded.spec, "http://developer.mozilla.org/");  do_check_eq(observer._itemAddedFolder, workFolder);  do_check_eq(observer._itemAddedIndex, 0);  // change item  bmsvc.setItemTitle(uri("http://developer.mozilla.org/"), "DevMo");  do_check_eq(observer._itemChanged.spec, "http://developer.mozilla.org/");  do_check_eq(observer._itemChangedProperty, "title");  // insert item  bmsvc.insertItem(workFolder, uri("http://msdn.microsoft.com/"), -1);  do_check_eq(observer._itemAdded.spec, "http://msdn.microsoft.com/");  do_check_eq(observer._itemAddedFolder, workFolder);  do_check_eq(observer._itemAddedIndex, 1);  // change item  bmsvc.setItemTitle(uri("http://msdn.microsoft.com/"), "MSDN");  do_check_eq(observer._itemChanged.spec, "http://msdn.microsoft.com/");  do_check_eq(observer._itemChangedProperty, "title");  // remove item  bmsvc.removeItem(workFolder, uri("http://developer.mozilla.org/"));  do_check_eq(observer._itemRemoved.spec, "http://developer.mozilla.org/");  do_check_eq(observer._itemRemovedFolder, workFolder);  do_check_eq(observer._itemRemovedIndex, 0);  // insert item  bmsvc.insertItem(workFolder, uri("http://developer.mozilla.org/"), -1);  do_check_eq(observer._itemAdded.spec, "http://developer.mozilla.org/");  do_check_eq(observer._itemAddedFolder, workFolder);  do_check_eq(observer._itemAddedIndex, 1);    // replace item  bmsvc.replaceItem(workFolder, uri("http://developer.mozilla.org/"),    uri("http://developer.mozilla.org/devnews/"));  do_check_eq(observer._itemReplaced.spec, "http://developer.mozilla.org/");  do_check_eq(observer._itemReplacedNew.spec, "http://developer.mozilla.org/devnews/");  do_check_eq(observer._itemReplacedFolder, workFolder);  // create folder  var homeFolder = bmsvc.createFolder(root, "Home", -1);  do_check_eq(observer._folderAdded, homeFolder);  do_check_eq(observer._folderAddedParent, root);  do_check_eq(observer._folderAddedIndex, 5);  // insert item  bmsvc.insertItem(homeFolder, uri("http://espn.com/"), 0);  do_check_eq(observer._itemAdded.spec, "http://espn.com/");  do_check_eq(observer._itemAddedFolder, homeFolder);  do_check_eq(observer._itemAddedIndex, 0);  // change item  bmsvc.setItemTitle(uri("http://espn.com/"), "ESPN");  do_check_eq(observer._itemChanged.spec, "http://espn.com/");  do_check_eq(observer._itemChangedProperty, "title");  // insert item  bmsvc.insertItem(root, uri("place:domain=google.com&group=1"), -1);  do_check_eq(observer._itemAdded.spec, "place:domain=google.com&group=1");  do_check_eq(observer._itemAddedFolder, root);  do_check_eq(observer._itemAddedIndex, 6);  // change item  bmsvc.setItemTitle(uri("place:domain=google.com&group=1"), "Google Sites");  do_check_eq(observer._itemChanged.spec, "place:domain=google.com&group=1");  do_check_eq(observer._itemChangedProperty, "title");  // move folder  bmsvc.moveFolder(workFolder, root, -1);  do_check_eq(observer._folderMoved, workFolder);  do_check_eq(observer._folderMovedOldParent, root);  do_check_eq(observer._folderMovedOldIndex, 3);  do_check_eq(observer._folderMovedNewParent, root);  do_check_eq(observer._folderMovedNewIndex, 6);  // Test expected failure of moving a folder to be its own parent  try {    bmsvc.moveFolder(workFolder, workFolder, -1);    do_throw("moveFolder() allowed moving a folder to be it's own parent.");  } catch (e) {}  do_check_eq(bmsvc.indexOfItem(root, uri("http://google.com/")), 3);  do_check_eq(bmsvc.indexOfFolder(root, workFolder), 6);}
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/552334070053b902ad2629c6ac05db1f0f7fdc9e/test_bookmarks.js/buggy/browser/components/places/tests/bookmarks/test_bookmarks.js