Bug 1377181 - PlacesUtils.getFolderContents should throw if a non-id is passed. r?mak draft
authorMark Banner <standard8@mozilla.com>
Thu, 29 Jun 2017 11:28:11 -0700
changeset 602146 0fb511de60ab6684001a5766988c73f3f2e641eb
parent 601236 306d2070e105b75f7076d30cc0288171f1435c07
child 635479 56bea18f1a619964ee3363ac5610bc3d23ed584b
push id66298
push userbmo:standard8@mozilla.com
push dateThu, 29 Jun 2017 18:31:14 +0000
reviewersmak
bugs1377181
milestone56.0a1
Bug 1377181 - PlacesUtils.getFolderContents should throw if a non-id is passed. r?mak MozReview-Commit-ID: KknK4wTYBAc
toolkit/components/places/PlacesUtils.jsm
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1073,16 +1073,19 @@ this.PlacesUtils = {
    *          True to make query items expand as new containers. For managing,
    *          you want this to be false, for menus and such, you want this to
    *          be true.
    * @returns A nsINavHistoryResult containing the contents of the
    *          folder. The result.root is guaranteed to be open.
    */
   getFolderContents:
   function PU_getFolderContents(aFolderId, aExcludeItems, aExpandQueries) {
+    if (typeof aFolderId !== "number") {
+      throw new Error("aFolderId should be a number.");
+    }
     var query = this.history.getNewQuery();
     query.setFolders([aFolderId], 1);
     var options = this.history.getNewQueryOptions();
     options.excludeItems = aExcludeItems;
     options.expandQueries = aExpandQueries;
 
     var result = this.history.executeQuery(query, options);
     result.root.containerOpen = true;