Bug 1377181 - PlacesUtils.getFolderContents should throw if a non-id is passed. r?mak
MozReview-Commit-ID: KknK4wTYBAc
--- 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;