Bug 1451719 - Add the failing type to a bookmarks error, and replace some xpcom interface usages with pure javascript ones. r?mak draft
authorMark Banner <standard8@mozilla.com>
Thu, 05 Apr 2018 13:36:08 +0100
changeset 777867 0ef08709c559679b2225d52b72de8eba0ca343c1
parent 777823 1b258f938525fda65ef80ffa0408bc665d5d8948
push id105312
push userbmo:standard8@mozilla.com
push dateThu, 05 Apr 2018 12:36:31 +0000
reviewersmak
bugs1451719
milestone61.0a1
Bug 1451719 - Add the failing type to a bookmarks error, and replace some xpcom interface usages with pure javascript ones. r?mak MozReview-Commit-ID: 1MSbFOsraLV
toolkit/components/places/PlacesUtils.jsm
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1751,46 +1751,46 @@ var PlacesUtils = {
         try {
           item.annos = await PlacesUtils.promiseAnnotationsForItem(itemId);
         } catch (ex) {
           Cu.reportError("Unexpected error while reading annotations " + ex);
         }
       }
 
       switch (type) {
-        case Ci.nsINavBookmarksService.TYPE_BOOKMARK:
+        case PlacesUtils.bookmarks.TYPE_BOOKMARK:
           item.type = PlacesUtils.TYPE_X_MOZ_PLACE;
           // If this throws due to an invalid url, the item will be skipped.
           item.uri = NetUtil.newURI(aRow.getResultByName("url")).spec;
           // Keywords are cached, so this should be decently fast.
           let entry = await PlacesUtils.keywords.fetch({ url: item.uri });
           if (entry) {
             item.keyword = entry.keyword;
             item.postData = entry.postData;
           }
           break;
-        case Ci.nsINavBookmarksService.TYPE_FOLDER:
+        case PlacesUtils.bookmarks.TYPE_FOLDER:
           item.type = PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER;
           // Mark root folders.
           if (itemId == PlacesUtils.placesRootId)
             item.root = "placesRoot";
           else if (itemId == PlacesUtils.bookmarksMenuFolderId)
             item.root = "bookmarksMenuFolder";
           else if (itemId == PlacesUtils.unfiledBookmarksFolderId)
             item.root = "unfiledBookmarksFolder";
           else if (itemId == PlacesUtils.toolbarFolderId)
             item.root = "toolbarFolder";
           else if (itemId == PlacesUtils.mobileFolderId)
             item.root = "mobileFolder";
           break;
-        case Ci.nsINavBookmarksService.TYPE_SEPARATOR:
+        case PlacesUtils.bookmarks.TYPE_SEPARATOR:
           item.type = PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR;
           break;
         default:
-          Cu.reportError("Unexpected bookmark type");
+          Cu.reportError(`Unexpected bookmark type ${type}`);
           break;
       }
       return item;
     };
 
     const QUERY_STR =
       `/* do not warn (bug no): cannot use an index */
        WITH RECURSIVE