43 var
bmsvc =
Cc[
"@mozilla.org/browser/nav-bookmarks-service;1"].getService(
Ci.nsINavBookmarksService);
45 do_throw(
"Could not get nav-bookmarks-service\n");
50 var lmsvc =
Cc[
"@mozilla.org/browser/livemark-service;2"].getService(
Ci.nsILivemarkService);
52 do_throw(
"Could not get livemark-service\n");
57 var mss =
Cc[
"@mozilla.org/microsummary/service;1"].getService(
Ci.nsIMicrosummaryService);
59 do_throw(
"Could not get microsummary-service\n");
64 var ptSvc =
Cc[
"@mozilla.org/browser/placesTransactionsService;1"].
67 do_throw(
"Could not get Places Transactions Service\n");
72 var tagssvc =
Cc[
"@mozilla.org/browser/tagging-service;1"].
75 do_throw(
"Could not get tagging service\n");
80 var annosvc =
Cc[
"@mozilla.org/browser/annotation-service;1"].
83 do_throw(
"Could not get annotations service\n");
89 this._beginUpdateBatch =
true;
92 this._endUpdateBatch =
true;
94 onItemAdded:
function(
id, folder, index, itemType) {
95 this._itemAddedId =
id;
96 this._itemAddedParent = folder;
97 this._itemAddedIndex = index;
98 this._itemAddedType = itemType;
100 onBeforeItemRemoved:
function(
id) {
102 onItemRemoved:
function(
id, folder, index, itemType) {
103 this._itemRemovedId =
id;
104 this._itemRemovedFolder = folder;
105 this._itemRemovedIndex = index;
107 onItemChanged:
function(
id, property, isAnnotationProperty, newValue,
108 lastModified, itemType) {
109 this._itemChangedId =
id;
110 this._itemChangedProperty = property;
111 this._itemChanged_isAnnotationProperty = isAnnotationProperty;
112 this._itemChangedValue = newValue;
114 onItemVisited:
function(
id, visitID, time) {
115 this._itemVisitedId =
id;
116 this._itemVisitedVistId = visitID;
117 this._itemVisitedTime = time;
119 onItemMoved:
function(
id, oldParent, oldIndex, newParent, newIndex,
121 this._itemMovedId =
id
122 this._itemMovedOldParent = oldParent;
123 this._itemMovedOldIndex = oldIndex;
124 this._itemMovedNewParent = newParent;
125 this._itemMovedNewIndex = newIndex;
128 if (iid.equals(
Ci.nsINavBookmarkObserver) ||
129 iid.equals(
Ci.nsISupports)) {
132 throw Cr.NS_ERROR_NO_INTERFACE;
135 bmsvc.addObserver(observer,
false);
143 var root =
bmsvc.bookmarksMenuFolder;
147 const TEST_DESCRIPTION =
"this is my test description";
149 type: annosvc.TYPE_STRING,
151 value: TEST_DESCRIPTION,
152 expires: annosvc.EXPIRE_NEVER }];
153 var txn1 = ptSvc.createFolder(
"Testing folder", root, bmStartIndex, annos);
154 ptSvc.doTransaction(txn1);
160 ptSvc.undoTransaction();
162 var folderId = observer._itemAddedId;
164 do_check_eq(observer._itemAddedIndex, bmStartIndex);
170 txn1.undoTransaction();
173 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
174 txn1.redoTransaction();
175 do_check_eq(observer._itemAddedIndex, bmStartIndex);
178 txn1.undoTransaction();
181 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
185 var txn2 = ptSvc.createItem(
uri(
"http://www.example.com"), root, bmStartIndex,
"Testing1");
186 ptSvc.doTransaction(txn2);
187 var b = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example.com"), {}))[0];
189 do_check_eq(observer._itemAddedIndex, bmStartIndex);
190 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.example.com")));
191 txn2.undoTransaction();
193 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
194 do_check_false(
bmsvc.isBookmarked(
uri(
"http://www.example.com")));
195 txn2.redoTransaction();
196 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.example.com")));
197 var newId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example.com"), {}))[0];
198 do_check_eq(observer._itemAddedIndex, bmStartIndex);
201 txn2.undoTransaction();
204 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
207 var txn2a = ptSvc.createFolder(
"Folder", root, bmStartIndex);
208 ptSvc.doTransaction(txn2a);
209 var fldrId = observer._itemAddedId;
212 var txn2b = ptSvc.createItem(
uri(
"http://www.example2.com"), fldrId, bmStartIndex,
"Testing1b");
213 ptSvc.doTransaction(txn2b);
214 var b2 = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example2.com"), {}))[0];
216 do_check_eq(observer._itemAddedIndex, bmStartIndex);
217 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.example2.com")));
218 txn2b.undoTransaction();
220 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
221 txn2b.redoTransaction();
222 newId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example2.com"), {}))[0];
223 do_check_eq(observer._itemAddedIndex, bmStartIndex);
226 txn2b.undoTransaction();
229 do_check_eq(observer._itemRemovedIndex, bmStartIndex);
232 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.example3.com"), root, -1,
"Testing2"));
233 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.example3.com"), root, -1,
"Testing3"));
234 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.example3.com"), fldrId, -1,
"Testing4"));
235 var bkmkIds =
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example3.com"), {});
237 var bkmk1Id = bkmkIds[0];
238 var bkmk2Id = bkmkIds[1];
239 var bkmk3Id = bkmkIds[2];
242 var txn3 = ptSvc.moveItem(bkmk1Id, root, -1);
243 txn3.doTransaction();
249 txn3.undoTransaction();
255 txn3.redoTransaction();
261 txn3.undoTransaction();
269 var txn3b = ptSvc.moveItem(bkmk1Id, fldrId, -1);
270 txn3b.doTransaction();
276 txn3.undoTransaction();
282 txn3b.redoTransaction();
288 txn3.undoTransaction();
296 ptSvc.doTransaction(ptSvc.createFolder(
"Folder2", root, -1));
297 var fldrId2 = observer._itemAddedId;
300 var txn4 = ptSvc.removeItem(fldrId2);
301 txn4.doTransaction();
305 txn4.undoTransaction();
309 txn4.redoTransaction();
313 txn4.undoTransaction();
319 bmsvc.setKeywordForBookmark(bkmk2Id,
"test_keyword");
320 var txn5 = ptSvc.removeItem(bkmk2Id);
321 txn5.doTransaction();
326 txn5.undoTransaction();
327 var newbkmk2Id = observer._itemAddedId;
331 txn5.redoTransaction();
336 txn5.undoTransaction();
341 var txn6 = ptSvc.createSeparator(root, 1);
342 txn6.doTransaction();
343 var sepId = observer._itemAddedId;
346 txn6.undoTransaction();
350 txn6.redoTransaction();
351 var newSepId = observer._itemAddedId;
354 txn6.undoTransaction();
360 ptSvc.doTransaction(ptSvc.createSeparator(root, 1));
361 var sepId2 = observer._itemAddedId;
362 var txn7 = ptSvc.removeItem(sepId2);
363 txn7.doTransaction();
367 txn7.undoTransaction();
371 txn7.redoTransaction();
375 txn7.undoTransaction();
381 var txn8 = ptSvc.editItemTitle(bkmk1Id,
"Testing2_mod");
382 txn8.doTransaction();
384 do_check_eq(observer._itemChangedProperty,
"title");
385 do_check_eq(observer._itemChangedValue,
"Testing2_mod");
386 txn8.undoTransaction();
388 do_check_eq(observer._itemChangedProperty,
"title");
389 do_check_eq(observer._itemChangedValue,
"Testing2");
390 txn8.redoTransaction();
392 do_check_eq(observer._itemChangedProperty,
"title");
393 do_check_eq(observer._itemChangedValue,
"Testing2_mod");
394 txn8.undoTransaction();
396 do_check_eq(observer._itemChangedProperty,
"title");
397 do_check_eq(observer._itemChangedValue,
"Testing2");
400 var txn9 = ptSvc.editBookmarkURI(bkmk1Id,
uri(
"http://newuri.com"));
401 txn9.doTransaction();
404 do_check_eq(observer._itemChangedValue,
"http://newuri.com/");
405 txn9.undoTransaction();
408 do_check_eq(observer._itemChangedValue,
"http://www.example3.com/");
409 txn9.redoTransaction();
412 do_check_eq(observer._itemChangedValue,
"http://newuri.com/");
413 txn9.undoTransaction();
416 do_check_eq(observer._itemChangedValue,
"http://www.example3.com/");
419 var txn10 = ptSvc.editItemDescription(bkmk1Id,
"Description1");
420 txn10.doTransaction();
422 do_check_eq(observer._itemChangedProperty,
"bookmarkProperties/description");
425 var txn11 = ptSvc.editBookmarkKeyword(bkmk1Id,
"kw1");
426 txn11.doTransaction();
428 do_check_eq(observer._itemChangedProperty,
"keyword");
430 txn11.undoTransaction();
432 do_check_eq(observer._itemChangedProperty,
"keyword");
436 var txn12 = ptSvc.createLivemark(
uri(
"http://feeduri.com"),
437 uri(
"http://siteuri.com"),
439 txn12.doTransaction();
440 var lvmkId = observer._itemAddedId;
441 do_check_true(lmsvc.isLivemark(lvmkId));
442 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://siteuri.com/");
443 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://feeduri.com/");
444 txn12.undoTransaction();
445 do_check_false(lmsvc.isLivemark(lvmkId));
446 txn12.redoTransaction();
447 lvmkId = observer._itemAddedId;
448 do_check_true(lmsvc.isLivemark(lvmkId));
449 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://siteuri.com/");
450 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://feeduri.com/");
453 var txn13 = ptSvc.editLivemarkSiteURI(lvmkId,
uri(
"http://new-siteuri.com/"));
454 txn13.doTransaction();
456 do_check_eq(observer._itemChangedProperty,
"livemark/siteURI");
457 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://new-siteuri.com/");
458 txn13.undoTransaction();
460 do_check_eq(observer._itemChangedProperty,
"livemark/siteURI");
462 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://siteuri.com/");
463 txn13.redoTransaction();
465 do_check_eq(observer._itemChangedProperty,
"livemark/siteURI");
466 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://new-siteuri.com/");
467 txn13.undoTransaction();
469 do_check_eq(observer._itemChangedProperty,
"livemark/siteURI");
471 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://siteuri.com/");
474 var txn14 = ptSvc.editLivemarkFeedURI(lvmkId,
uri(
"http://new-feeduri.com/"));
475 txn14.doTransaction();
477 do_check_eq(observer._itemChangedProperty,
"livemark/feedURI");
478 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://new-feeduri.com/");
479 txn14.undoTransaction();
481 do_check_eq(observer._itemChangedProperty,
"livemark/feedURI");
483 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://feeduri.com/");
484 txn14.redoTransaction();
486 do_check_eq(observer._itemChangedProperty,
"livemark/feedURI");
488 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://new-feeduri.com/");
489 txn14.undoTransaction();
491 do_check_eq(observer._itemChangedProperty,
"livemark/feedURI");
493 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://feeduri.com/");
497 annosvc.setItemAnnotation(lvmkId,
"livemark/testAnno",
"testAnno",
498 0, annosvc.EXPIRE_NEVER);
499 var txn15 = ptSvc.removeItem(lvmkId);
500 txn15.doTransaction();
501 do_check_false(lmsvc.isLivemark(lvmkId));
503 txn15.undoTransaction();
504 lvmkId = observer._itemAddedId;
505 do_check_true(lmsvc.isLivemark(lvmkId));
506 do_check_eq(lmsvc.getSiteURI(lvmkId).spec,
"http://siteuri.com/");
507 do_check_eq(lmsvc.getFeedURI(lvmkId).spec,
"http://feeduri.com/");
508 do_check_eq(annosvc.getItemAnnotation(lvmkId,
"livemark/testAnno"),
"testAnno");
509 txn15.redoTransaction();
510 do_check_false(lmsvc.isLivemark(lvmkId));
515 var txn16 = ptSvc.setLoadInSidebar(bkmk1Id,
true);
516 txn16.doTransaction();
519 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
520 txn16.undoTransaction();
523 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
526 var itemAnnoObj = {
name:
"testAnno/testInt",
527 type:
Ci.nsIAnnotationService.TYPE_INT32,
530 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
531 var genItemAnnoTxn = ptSvc.setItemAnnotation(bkmk1Id, itemAnnoObj);
532 genItemAnnoTxn.doTransaction();
534 do_check_eq(observer._itemChangedProperty,
"testAnno/testInt");
535 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
536 genItemAnnoTxn.undoTransaction();
538 do_check_eq(observer._itemChangedProperty,
"testAnno/testInt");
539 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
540 genItemAnnoTxn.redoTransaction();
542 do_check_eq(observer._itemChangedProperty,
"testAnno/testInt");
543 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
546 var pageAnnoObj = {
name:
"testAnno/testInt",
547 type:
Ci.nsIAnnotationService.TYPE_INT32,
550 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
551 var genPageAnnoTxn = ptSvc.setPageAnnotation(
uri(
"http://www.mozilla.org/"), pageAnnoObj);
552 genPageAnnoTxn.doTransaction();
553 do_check_true(annosvc.pageHasAnnotation(
uri(
"http://www.mozilla.org/"),
"testAnno/testInt"));
554 genPageAnnoTxn.undoTransaction();
555 do_check_false(annosvc.pageHasAnnotation(
uri(
"http://www.mozilla.org/"),
"testAnno/testInt"));
556 genPageAnnoTxn.redoTransaction();
557 do_check_true(annosvc.pageHasAnnotation(
uri(
"http://www.mozilla.org/"),
"testAnno/testInt"));
560 ptSvc.doTransaction(ptSvc.createFolder(
"Sorting folder", root, bmStartIndex, [],
null));
561 var srtFldId = observer._itemAddedId;
563 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.sortingtest.com"), srtFldId, -1,
"c"));
564 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.sortingtest.com"), srtFldId, -1,
"b"));
565 ptSvc.doTransaction(ptSvc.createItem(
uri(
"http://www.sortingtest.com"), srtFldId, -1,
"a"));
566 var b =
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.sortingtest.com"), {});
574 var txn17 = ptSvc.sortFolderByName(srtFldId);
575 txn17.doTransaction();
579 txn17.undoTransaction();
583 txn17.redoTransaction();
587 txn17.undoTransaction();
593 var tmpMs = mss.createMicrosummary(
uri(
"http://testmicro.com"),
594 uri(
"http://dietrich.ganx4.com/mozilla/test-microsummary.xml"));
596 ptSvc.createItem(
uri(
"http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),
598 var bId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://dietrich.ganx4.com/mozilla/test-microsummary-content.php"),{}))[0];
599 do_check_true(!mss.hasMicrosummary(bId));
600 var txn18 = ptSvc.editBookmarkMicrosummary(bId, tmpMs);
601 txn18.doTransaction();
603 do_check_true(mss.hasMicrosummary(bId));
604 txn18.undoTransaction();
606 do_check_true(!mss.hasMicrosummary(bId));
610 var postData =
"foo";
611 var postDataURI =
uri(
"http://foo.com");
613 ptSvc.createItem(postDataURI, root, -1,
"postdata test",
null,
null,
null));
614 var postDataId = (
bmsvc.getBookmarkIdsForURI(postDataURI,{}))[0];
615 var postDataTxn = ptSvc.editBookmarkPostData(postDataId, postData);
616 postDataTxn.doTransaction();
617 do_check_true(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
618 do_check_eq(annosvc.getItemAnnotation(postDataId, POST_DATA_ANNO), postData);
619 postDataTxn.undoTransaction();
620 do_check_false(annosvc.itemHasAnnotation(postDataId, POST_DATA_ANNO))
623 var oldAdded =
bmsvc.getItemDateAdded(bkmk1Id);
624 var newAdded = Date.now();
625 var eidaTxn = ptSvc.editItemDateAdded(bkmk1Id, newAdded);
626 eidaTxn.doTransaction();
628 eidaTxn.undoTransaction();
632 var oldModified =
bmsvc.getItemLastModified(bkmk1Id);
633 var newModified = Date.now();
634 var eilmTxn = ptSvc.editItemLastModified(bkmk1Id, newModified);
635 eilmTxn.doTransaction();
637 eilmTxn.undoTransaction();
641 var tagURI =
uri(
"http://foo.tld");
642 var tagTxn = ptSvc.tagURI(tagURI, [
"foo",
"bar"]);
643 tagTxn.doTransaction();
644 do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval([
"bar",
"foo"]));
645 tagTxn.undoTransaction();
646 do_check_true(tagssvc.getTagsForURI(tagURI, { }).length == 0);
647 tagTxn.redoTransaction();
648 do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval([
"bar",
"foo"]));
649 var untagTxn = ptSvc.untagURI(tagURI, [
"bar"]);
650 untagTxn.doTransaction();
651 do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval([
"foo"]));
652 untagTxn.undoTransaction();
653 do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval([
"bar",
"foo"]));
654 untagTxn.redoTransaction();
655 do_check_eq(uneval(tagssvc.getTagsForURI(tagURI, { })), uneval([
"foo"]));
658 var bkmk1Id =
bmsvc.insertBookmark(root,
uri(
"http://www.mozilla.org/"), 0,
"Mozilla");
659 var bkmk2Id =
bmsvc.insertSeparator(root, 1);
660 var bkmk3Id =
bmsvc.createFolder(root,
"folder", 2);
661 var bkmk3_1Id =
bmsvc.insertBookmark(bkmk3Id,
uri(
"http://www.mozilla.org/"), 0,
"Mozilla");
662 var bkmk3_2Id =
bmsvc.insertSeparator(bkmk3Id, 1);
663 var bkmk3_3Id =
bmsvc.createFolder(bkmk3Id,
"folder", 2);
665 var transactions = [];
666 transactions.push(ptSvc.removeItem(bkmk1Id));
667 transactions.push(ptSvc.removeItem(bkmk2Id));
668 transactions.push(ptSvc.removeItem(bkmk3Id));
669 var txn = ptSvc.aggregateTransactions(
"RemoveItems", transactions);
681 txn.undoTransaction();
682 var newBkmk1Id =
bmsvc.getIdForItemAt(root, 0);
683 var newBkmk2Id =
bmsvc.getIdForItemAt(root, 1);
684 var newBkmk3Id =
bmsvc.getIdForItemAt(root, 2);
685 var newBkmk3_1Id =
bmsvc.getIdForItemAt(newBkmk3Id, 0);
686 var newBkmk3_2Id =
bmsvc.getIdForItemAt(newBkmk3Id, 1);
687 var newBkmk3_3Id =
bmsvc.getIdForItemAt(newBkmk3Id, 2);
689 do_check_eq(
bmsvc.getBookmarkURI(newBkmk1Id).spec,
"http://www.mozilla.org/");
695 do_check_eq(
bmsvc.getBookmarkURI(newBkmk3_1Id).spec,
"http://www.mozilla.org/");
705 txn.redoTransaction();
715 txn.undoTransaction();
716 newBkmk1Id =
bmsvc.getIdForItemAt(root, 0);
717 newBkmk2Id =
bmsvc.getIdForItemAt(root, 1);
718 newBkmk3Id =
bmsvc.getIdForItemAt(root, 2);
719 newBkmk3_1Id =
bmsvc.getIdForItemAt(newBkmk3Id, 0);
720 newBkmk3_2Id =
bmsvc.getIdForItemAt(newBkmk3Id, 1);
721 newBkmk3_3Id =
bmsvc.getIdForItemAt(newBkmk3Id, 2);
723 do_check_eq(
bmsvc.getBookmarkURI(newBkmk1Id).spec,
"http://www.mozilla.org/");
729 do_check_eq(
bmsvc.getBookmarkURI(newBkmk3_1Id).spec,
"http://www.mozilla.org/");
741 var newDateAdded = Date.now() - 20000;
742 childTxns.push(ptSvc.editItemDateAdded(
null, newDateAdded));
743 var itemChildAnnoObj = {
name:
"testAnno/testInt",
744 type:
Ci.nsIAnnotationService.TYPE_INT32,
747 expires:
Ci.nsIAnnotationService.EXPIRE_NEVER };
748 childTxns.push(ptSvc.setItemAnnotation(
null, itemChildAnnoObj));
749 var itemWChildTxn = ptSvc.createItem(
uri(
"http://www.example.com"), root,
753 ptSvc.doTransaction(itemWChildTxn);
754 var itemId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example.com"), {}))[0];
757 do_check_eq(observer._itemChangedProperty,
"testAnno/testInt");
758 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
759 do_check_true(annosvc.itemHasAnnotation(itemId, itemChildAnnoObj.name))
760 do_check_eq(annosvc.getItemAnnotation(itemId, itemChildAnnoObj.name),
761 itemChildAnnoObj.value);
762 itemWChildTxn.undoTransaction();
764 itemWChildTxn.redoTransaction();
765 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.example.com")));
766 var newId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.example.com"), {}))[0];
769 do_check_eq(observer._itemChangedProperty,
"testAnno/testInt");
770 do_check_eq(observer._itemChanged_isAnnotationProperty,
true);
771 do_check_true(annosvc.itemHasAnnotation(newId, itemChildAnnoObj.name))
772 do_check_eq(annosvc.getItemAnnotation(newId, itemChildAnnoObj.name),
773 itemChildAnnoObj.value);
774 itemWChildTxn.undoTransaction();
777 do_throw(
"Setting a child transaction in a createItem transaction did throw: " + ex);
781 var childItemTxn = ptSvc.createItem(
uri(
"http://www.childItem.com"), root,
bmStartIndex,
"childItem");
782 var folderWChildItemTxn = ptSvc.createFolder(
"Folder", root,
bmStartIndex,
null, [childItemTxn]);
784 ptSvc.doTransaction(folderWChildItemTxn);
785 var childItemId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.childItem.com"), {}))[0];
788 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.childItem.com")));
789 folderWChildItemTxn.undoTransaction();
790 do_check_false(
bmsvc.isBookmarked(
uri(
"http://www.childItem.com")));
791 folderWChildItemTxn.redoTransaction();
792 newchildItemId = (
bmsvc.getBookmarkIdsForURI(
uri(
"http://www.childItem.com"), {}))[0];
794 do_check_eq(observer._itemAddedId, newchildItemId);
795 do_check_true(
bmsvc.isBookmarked(
uri(
"http://www.childItem.com")));
796 folderWChildItemTxn.undoTransaction();
797 do_check_false(
bmsvc.isBookmarked(
uri(
"http://www.childItem.com")));
799 do_throw(
"Setting a child item transaction in a createFolder transaction did throw: " + ex);
802 bmsvc.removeObserver(observer,
false);
do_check_eq(typeof PlacesUtils,"object")
onPageChanged onEndUpdateBatch
sbDeviceFirmwareAutoCheckForUpdate prototype flags
sbOSDControlService prototype QueryInterface
getService(Ci.sbIFaceplateManager)
onPageChanged onBeginUpdateBatch
#define LOAD_IN_SIDEBAR_ANNO