Bug 1481445 - Replace usage of the old bookmark ids in promiseBookmarksTree with guids. r=lina
authorMark Banner <standard8@mozilla.com>
Tue, 07 Aug 2018 15:01:32 +0000
changeset 430385 bb1e58f3dad739efcbc358db733f885f94d667d1
parent 430384 76baf773b83e93b2b4c4457521671e93dbe07caa
child 430386 d7e3e9bba8e00fca228bec97b2da1b5e0ad9540b
push id67457
push usermbanner@mozilla.com
push dateTue, 07 Aug 2018 18:11:34 +0000
treeherderautoland@bb1e58f3dad7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslina
bugs1481445
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481445 - Replace usage of the old bookmark ids in promiseBookmarksTree with guids. r=lina MozReview-Commit-ID: AgqSKneywM4 Differential Revision: https://phabricator.services.mozilla.com/D2850
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/tests/head_common.js
toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1689,25 +1689,25 @@ var PlacesUtils = {
           if (entry) {
             item.keyword = entry.keyword;
             item.postData = entry.postData;
           }
           break;
         case PlacesUtils.bookmarks.TYPE_FOLDER:
           item.type = PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER;
           // Mark root folders.
-          if (itemId == PlacesUtils.placesRootId)
+          if (item.guid == PlacesUtils.bookmarks.rootGuid)
             item.root = "placesRoot";
-          else if (itemId == PlacesUtils.bookmarksMenuFolderId)
+          else if (item.guid == PlacesUtils.bookmarks.menuGuid)
             item.root = "bookmarksMenuFolder";
-          else if (itemId == PlacesUtils.unfiledBookmarksFolderId)
+          else if (item.guid == PlacesUtils.bookmarks.unfiledGuid)
             item.root = "unfiledBookmarksFolder";
-          else if (itemId == PlacesUtils.toolbarFolderId)
+          else if (item.guid == PlacesUtils.bookmarks.toolbarGuid)
             item.root = "toolbarFolder";
-          else if (itemId == PlacesUtils.mobileFolderId)
+          else if (item.guid == PlacesUtils.bookmarks.mobileGuid)
             item.root = "mobileFolder";
           break;
         case PlacesUtils.bookmarks.TYPE_SEPARATOR:
           item.type = PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR;
           break;
         default:
           Cu.reportError(`Unexpected bookmark type ${type}`);
           break;
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -882,35 +882,35 @@ async function compareFavicons(icon1, ic
   let data1 = await getIconData(icon1);
   Assert.ok(data1.length > 0, "Should fetch icon data");
   let data2 = await getIconData(icon2);
   Assert.ok(data2.length > 0, "Should fetch icon data");
   Assert.deepEqual(data1, data2, msg);
 }
 
 /**
- * Get the internal "root" folder name for an item, specified by its itemId.
- * If the itemId does not point to a root folder, null is returned.
+ * Get the internal "root" folder name for an item, specified by its itemGuid.
+ * If the itemGuid does not point to a root folder, null is returned.
  *
- * @param aItemId
- *        the item id.
- * @return the internal-root name for the root folder, if aItemId points
+ * @param itemGuid
+ *        the item guid.
+ * @return the internal-root name for the root folder, if itemGuid points
  * to such folder, null otherwise.
  */
-function mapItemIdToInternalRootName(aItemId) {
-  switch (aItemId) {
-    case PlacesUtils.placesRootId:
+function mapItemGuidToInternalRootName(itemGuid) {
+  switch (itemGuid) {
+    case PlacesUtils.bookmarks.rootGuid:
       return "placesRoot";
-    case PlacesUtils.bookmarksMenuFolderId:
+    case PlacesUtils.bookmarks.menuGuid:
       return "bookmarksMenuFolder";
-    case PlacesUtils.toolbarFolderId:
+    case PlacesUtils.bookmarks.toolbarGuid:
       return "toolbarFolder";
-    case PlacesUtils.unfiledBookmarksFolderId:
+    case PlacesUtils.bookmarks.unfiledGuid:
       return "unfiledBookmarksFolder";
-    case PlacesUtils.mobileFolderId:
+    case PlacesUtils.bookmarks.mobileGuid:
       return "mobileFolder";
   }
   return null;
 }
 
 const DB_FILENAME = "places.sqlite";
 
 /**
--- a/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
+++ b/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
@@ -85,17 +85,17 @@ async function compareToNode(aItem, aNod
           nodesCount +=
             await compareToNode(aItem.children[i], expectedChildrenNodes[i],
                                 false, aExcludedGuids);
         }
       } else {
         check_unset("children");
       }
 
-      let rootName = mapItemIdToInternalRootName(aItem.id);
+      let rootName = mapItemGuidToInternalRootName(aItem.guid);
       if (rootName)
         Assert.equal(aItem.root, rootName);
       else
         check_unset("root");
       break;
     case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
       Assert.equal(aItem.type, PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR);
       Assert.equal(aItem.typeCode, PlacesUtils.bookmarks.TYPE_SEPARATOR);