Bug 1551779 part 2. Stop using [array] for get/setParents in nsINavHistoryService. r=mak
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 16 May 2019 13:06:11 +0000
changeset 536001 f5db7f234584c20947fc4fa592b1263d1582df0b
parent 536000 722c158c53865db371646a40084e26a8dd788ea3
child 536002 4c91b3e1fedeb142e9e79460b772c73902016392
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1551779
milestone68.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 1551779 part 2. Stop using [array] for get/setParents in nsINavHistoryService. r=mak Differential Revision: https://phabricator.services.mozilla.com/D31238
browser/components/places/content/places-tree.js
toolkit/components/places/PlacesUtils.jsm
toolkit/components/places/nsINavHistoryService.idl
toolkit/components/places/nsNavHistoryQuery.cpp
toolkit/components/places/nsNavHistoryQuery.h
toolkit/components/places/tests/bookmarks/test_384228.js
toolkit/components/places/tests/bookmarks/test_385829.js
toolkit/components/places/tests/bookmarks/test_448584.js
toolkit/components/places/tests/bookmarks/test_savedsearches.js
toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
toolkit/components/places/tests/legacy/test_bookmarks.js
toolkit/components/places/tests/queries/test_async.js
toolkit/components/places/tests/queries/test_history_queries_tags_liveUpdate.js
toolkit/components/places/tests/queries/test_onlyBookmarked.js
toolkit/components/places/tests/queries/test_options_inherit.js
toolkit/components/places/tests/queries/test_queryMultipleFolder.js
toolkit/components/places/tests/queries/test_querySerialization.js
toolkit/components/places/tests/queries/test_search_tags.js
toolkit/components/places/tests/queries/test_sorting.js
toolkit/components/places/tests/unit/test_331487.js
toolkit/components/places/tests/unit/test_419792_node_tags_property.js
toolkit/components/places/tests/unit/test_433317_query_title_update.js
toolkit/components/places/tests/unit/test_433525_hasChildren_crash.js
toolkit/components/places/tests/unit/test_broken_folderShortcut_result.js
toolkit/components/places/tests/unit/test_getChildIndex.js
toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
toolkit/components/places/tests/unit/test_placeURIs.js
toolkit/components/places/tests/unit/test_tagging.js
toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
--- a/browser/components/places/content/places-tree.js
+++ b/browser/components/places/content/places-tree.js
@@ -395,17 +395,17 @@
         options.resultType == options.RESULTS_AS_TAGS_ROOT ||
         options.resultType == options.RESULTS_AS_ROOTS_QUERY)
         options.resultType = options.RESULTS_AS_URI;
 
       var query = PlacesUtils.history.getNewQuery();
       query.searchTerms = filterString;
 
       if (folderRestrict) {
-        query.setParents(folderRestrict, folderRestrict.length);
+        query.setParents(folderRestrict);
         options.queryType = options.QUERY_TYPE_BOOKMARKS;
       }
 
       options.includeHidden = !!includeHidden;
 
       this.load(query, options);
     }
 
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -1167,17 +1167,17 @@ var PlacesUtils = {
    * @returns A nsINavHistoryResult containing the contents of the
    *          folder. The result.root is guaranteed to be open.
    */
   getFolderContents(aFolderGuid, aExcludeItems, aExpandQueries) {
     if (!this.isValidGuid(aFolderGuid)) {
       throw new Error("aFolderGuid should be a valid GUID.");
     }
     var query = this.history.getNewQuery();
-    query.setParents([aFolderGuid], 1);
+    query.setParents([aFolderGuid]);
     var options = this.history.getNewQueryOptions();
     options.excludeItems = aExcludeItems;
     options.expandQueries = aExpandQueries;
 
     var result = this.history.executeQuery(query, options);
     result.root.containerOpen = true;
     return result;
   },
--- a/toolkit/components/places/nsINavHistoryService.idl
+++ b/toolkit/components/places/nsINavHistoryService.idl
@@ -869,26 +869,24 @@ interface nsINavHistoryQuery : nsISuppor
    * are not tagged with any of the given tags.  This attribute is used in
    * conjunction with the 'tags' attribute.
    */
   attribute boolean tagsAreNot;
 
   /**
    * Limit results to items that are in all of the given folders.
    */
-  void getParents([optional] out unsigned long aGuidCount,
-                  [retval,array,size_is(aGuidCount)] out string aGuids);
+  Array<ACString> getParents();
   readonly attribute unsigned long parentCount;
 
   /**
    * This is not recursive so results will be returned from the first level of
    * that folder.
    */
-  void setParents([array, size_is(aGuidCount)] in string aGuids,
-                  in unsigned long aGuidCount);
+  void setParents(in Array<ACString> aGuids);
 
   /**
    * Creates a new query item with the same parameters of this one.
    */
   nsINavHistoryQuery clone();
 };
 
 /**
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -873,44 +873,30 @@ NS_IMETHODIMP nsNavHistoryQuery::GetTags
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNavHistoryQuery::SetTagsAreNot(bool aTagsAreNot) {
   mTagsAreNot = aTagsAreNot;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsNavHistoryQuery::GetParents(uint32_t* aGuidCount,
-                                            char*** aGuids) {
-  uint32_t count = mParents.Length();
-  char** guids = nullptr;
-  if (count > 0) {
-    guids = static_cast<char**>(moz_xmalloc(count * sizeof(char*)));
-
-    for (uint32_t i = 0; i < count; ++i) {
-      guids[i] = ToNewCString(mParents[i]);
-    }
-  }
-  *aGuidCount = count;
-  *aGuids = guids;
+NS_IMETHODIMP nsNavHistoryQuery::GetParents(nsTArray<nsCString>& aGuids) {
+  aGuids = mParents;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNavHistoryQuery::GetParentCount(uint32_t* aGuidCount) {
   *aGuidCount = mParents.Length();
   return NS_OK;
 }
 
-NS_IMETHODIMP nsNavHistoryQuery::SetParents(const char** aGuids,
-                                            uint32_t aGuidCount) {
+NS_IMETHODIMP nsNavHistoryQuery::SetParents(const nsTArray<nsCString>& aGuids) {
   mParents.Clear();
-  for (size_t i = 0; i < aGuidCount; i++) {
-    if (!mParents.AppendElement(aGuids[i])) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+  if (!mParents.Assign(aGuids, fallible)) {
+    return NS_ERROR_OUT_OF_MEMORY;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNavHistoryQuery::GetTransitions(
     nsTArray<uint32_t>& aTransitions) {
   aTransitions = mTransitions;
--- a/toolkit/components/places/nsNavHistoryQuery.h
+++ b/toolkit/components/places/nsNavHistoryQuery.h
@@ -43,22 +43,17 @@ class nsNavHistoryQuery final : public n
   uint32_t EndTimeReference() { return mEndTimeReference; }
   const nsString& SearchTerms() { return mSearchTerms; }
   bool OnlyBookmarked() { return mOnlyBookmarked; }
   bool DomainIsHost() { return mDomainIsHost; }
   const nsCString& Domain() { return mDomain; }
   nsIURI* Uri() { return mUri; }  // NOT AddRef-ed!
   bool AnnotationIsNot() { return mAnnotationIsNot; }
   const nsCString& Annotation() { return mAnnotation; }
-  const nsTArray<nsCString>& Parents() { return mParents; }
-  nsresult SetParents(const nsTArray<nsCString>& aParents) {
-    if (!mParents.ReplaceElementsAt(0, mParents.Length(), aParents))
-      return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
-  }
+  const nsTArray<nsCString>& Parents() const { return mParents; }
 
   const nsTArray<nsString>& Tags() const { return mTags; }
   nsresult SetTags(const nsTArray<nsString>& aTags) {
     if (!mTags.ReplaceElementsAt(0, mTags.Length(), aTags))
       return NS_ERROR_OUT_OF_MEMORY;
     return NS_OK;
   }
   bool TagsAreNot() { return mTagsAreNot; }
--- a/toolkit/components/places/tests/bookmarks/test_384228.js
+++ b/toolkit/components/places/tests/bookmarks/test_384228.js
@@ -74,17 +74,17 @@ add_task(async function search_bookmark_
 
 
   // query folder 1, folder 2 and get 4 bookmarks
   let hs = PlacesUtils.history;
   let options = hs.getNewQueryOptions();
   let query = hs.getNewQuery();
   query.searchTerms = "title";
   options.queryType = options.QUERY_TYPE_BOOKMARKS;
-  query.setParents([testFolder1.guid, testFolder2.guid], 2);
+  query.setParents([testFolder1.guid, testFolder2.guid]);
   let rootNode = hs.executeQuery(query, options).root;
   rootNode.containerOpen = true;
 
   // should not match item from folder 3
   Assert.equal(rootNode.childCount, 4);
   Assert.equal(rootNode.getChild(0).bookmarkGuid, b1.guid);
   Assert.equal(rootNode.getChild(1).bookmarkGuid, b2.guid);
   Assert.equal(rootNode.getChild(2).bookmarkGuid, b3.guid);
--- a/toolkit/components/places/tests/bookmarks/test_385829.js
+++ b/toolkit/components/places/tests/bookmarks/test_385829.js
@@ -61,17 +61,17 @@ add_task(async function search_bookmark_
     lastModified: new Date(modifiedTime.getTime() + 1000),
   });
 
   let hs = PlacesUtils.history;
   let options = hs.getNewQueryOptions();
   let query = hs.getNewQuery();
   options.queryType = options.QUERY_TYPE_BOOKMARKS;
   options.maxResults = 3;
-  query.setParents([folder.guid], 1);
+  query.setParents([folder.guid]);
 
   let result = hs.executeQuery(query, options);
   let rootNode = result.root;
   rootNode.containerOpen = true;
 
   // test SORT_BY_DATEADDED_ASCENDING (live update)
   result.sortingMode = options.SORT_BY_DATEADDED_ASCENDING;
   Assert.equal(rootNode.childCount, 3);
--- a/toolkit/components/places/tests/bookmarks/test_448584.js
+++ b/toolkit/components/places/tests/bookmarks/test_448584.js
@@ -16,17 +16,17 @@ try {
     - don't try to add invalid uri nodes to a JSON backup
 */
 
 const ITEM_TITLE = "invalid uri";
 const ITEM_URL = "http://test.mozilla.org";
 
 function validateResults(expectedValidItemsCount) {
   var query = PlacesUtils.history.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = PlacesUtils.history.getNewQueryOptions();
   var result = PlacesUtils.history.executeQuery(query, options);
 
   var toolbar = result.root;
   toolbar.containerOpen = true;
 
   // test for our bookmark
   Assert.equal(toolbar.childCount, expectedValidItemsCount);
--- a/toolkit/components/places/tests/bookmarks/test_savedsearches.js
+++ b/toolkit/components/places/tests/bookmarks/test_savedsearches.js
@@ -36,17 +36,17 @@ add_task(async function test_savedsearch
   });
 
   // query for the test root, expandQueries=0
   // the query should show up as a regular bookmark
   try {
     let options = PlacesUtils.history.getNewQueryOptions();
     options.expandQueries = 0;
     let query = PlacesUtils.history.getNewQuery();
-    query.setParents([testRoot.guid], 1);
+    query.setParents([testRoot.guid]);
     let result = PlacesUtils.history.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     let cc = rootNode.childCount;
     Assert.equal(cc, 1);
     for (let i = 0; i < cc; i++) {
       let node = rootNode.getChild(i);
       // test that queries have valid itemId
@@ -62,17 +62,17 @@ add_task(async function test_savedsearch
 
   // bookmark saved search
   // query for the test root, expandQueries=1
   // the query should show up as a query container, with 1 child
   try {
     let options = PlacesUtils.history.getNewQueryOptions();
     options.expandQueries = 1;
     let query = PlacesUtils.history.getNewQuery();
-    query.setParents([testRoot.guid], 1);
+    query.setParents([testRoot.guid]);
     let result = PlacesUtils.history.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     let cc = rootNode.childCount;
     Assert.equal(cc, 1);
     for (let i = 0; i < cc; i++) {
       let node = rootNode.getChild(i);
       // test that query node type is container when expandQueries=1
@@ -138,17 +138,17 @@ add_task(async function test_savedsearch
   });
 
   // query for the test root, expandQueries=1
   // the query should show up as a query container, with 1 child
   try {
     var options = PlacesUtils.history.getNewQueryOptions();
     options.expandQueries = 1;
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([testRoot.guid], 1);
+    query.setParents([testRoot.guid]);
     var result = PlacesUtils.history.executeQuery(query, options);
     var rootNode = result.root;
     rootNode.containerOpen = true;
     var cc = rootNode.childCount;
     Assert.equal(cc, 1);
     for (var i = 0; i < cc; i++) {
       var node = rootNode.getChild(i);
       // test that query node type is container when expandQueries=1
--- a/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
+++ b/toolkit/components/places/tests/favicons/test_query_result_favicon_changed_on_child.js
@@ -12,17 +12,17 @@ add_task(async function test_query_resul
     parentGuid: PlacesUtils.bookmarks.menuGuid,
     title: "test_bookmark",
     url: PAGE_URI,
   });
 
   // Get the last 10 bookmarks added to the menu or the toolbar.
   let query = PlacesUtils.history.getNewQuery();
   query.setParents([PlacesUtils.bookmarks.menuGuid,
-                    PlacesUtils.bookmarks.toolbarGuid], 2);
+                    PlacesUtils.bookmarks.toolbarGuid]);
 
   let options = PlacesUtils.history.getNewQueryOptions();
   options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
   options.maxResults = 10;
   options.excludeQueries = 1;
   options.sortingMode = options.SORT_BY_DATE_DESCENDING;
 
   let result = PlacesUtils.history.executeQuery(query, options);
--- a/toolkit/components/places/tests/legacy/test_bookmarks.js
+++ b/toolkit/components/places/tests/legacy/test_bookmarks.js
@@ -247,17 +247,17 @@ add_task(async function test_bookmarks()
   // change item
   bs.setItemTitle(newId6, "Google Sites");
   Assert.equal(bookmarksObserver._itemChangedProperty, "title");
 
   // test bookmark id in query output
   try {
     let options = hs.getNewQueryOptions();
     let query = hs.getNewQuery();
-    query.setParents([testRootGuid], 1);
+    query.setParents([testRootGuid]);
     let result = hs.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     let cc = rootNode.childCount;
     info("bookmark itemId test: CC = " + cc);
     Assert.ok(cc > 0);
     for (let i = 0; i < cc; ++i) {
       let node = rootNode.getChild(i);
@@ -285,17 +285,17 @@ add_task(async function test_bookmarks()
     let testFolderGuid = await PlacesUtils.promiseItemGuid(testFolder);
     // add 2 bookmarks
     bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 1");
     bs.insertBookmark(testFolder, mURI, bs.DEFAULT_INDEX, "title 2");
 
     // query
     let options = hs.getNewQueryOptions();
     let query = hs.getNewQuery();
-    query.setParents([testFolderGuid], 1);
+    query.setParents([testFolderGuid]);
     let result = hs.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     let cc = rootNode.childCount;
     Assert.equal(cc, 2);
     Assert.equal(rootNode.getChild(0).title, "title 1");
     Assert.equal(rootNode.getChild(1).title, "title 2");
     rootNode.containerOpen = false;
@@ -382,17 +382,17 @@ add_task(async function test_bookmarks()
     do_throw("bookmarks query: " + ex);
   }
 
   // test dateAdded and lastModified properties
   // for a folder query
   try {
     let options = hs.getNewQueryOptions();
     let query = hs.getNewQuery();
-    query.setParents([testRootGuid], 1);
+    query.setParents([testRootGuid]);
     let result = hs.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     let cc = rootNode.childCount;
     Assert.ok(cc > 0);
     for (let i = 0; i < cc; i++) {
       let node = rootNode.getChild(i);
 
@@ -473,17 +473,17 @@ async function testSimpleFolderResult() 
   bs.setItemTitle(folder, "test folder");
 
   let longName = Array(TITLE_LENGTH_MAX + 5).join("A");
   let folderLongName = bs.createFolder(parent, longName, bs.DEFAULT_INDEX);
   Assert.equal(bookmarksObserver._itemAddedTitle, longName.substring(0, TITLE_LENGTH_MAX));
 
   let options = hs.getNewQueryOptions();
   let query = hs.getNewQuery();
-  query.setParents([parentGuid], 1);
+  query.setParents([parentGuid]);
   let result = hs.executeQuery(query, options);
   let rootNode = result.root;
   rootNode.containerOpen = true;
   Assert.equal(rootNode.childCount, 3);
 
   let node = rootNode.getChild(0);
   Assert.equal(node.itemId, item);
   Assert.ok(node.dateAdded > 0);
--- a/toolkit/components/places/tests/queries/test_async.js
+++ b/toolkit/components/places/tests/queries/test_async.js
@@ -236,17 +236,17 @@ Test.prototype = {
       { type: "separator" },
       { type: "folder" },
       { type: "bookmark", uri: "place:terms=foo" },
     ]);
     await task_populateDB(this.data);
 
     // Make a query.
     this.query = PlacesUtils.history.getNewQuery();
-    this.query.setParents([DataHelper.defaults.bookmark.parentGuid], 1);
+    this.query.setParents([DataHelper.defaults.bookmark.parentGuid]);
     this.opts = PlacesUtils.history.getNewQueryOptions();
     this.opts.asyncEnabled = true;
     this.result = PlacesUtils.history.executeQuery(this.query, this.opts);
   },
 
   /**
    * Call this when the test has succeeded.  It cleans up resources and starts
    * the next test.
--- a/toolkit/components/places/tests/queries/test_history_queries_tags_liveUpdate.js
+++ b/toolkit/components/places/tests/queries/test_history_queries_tags_liveUpdate.js
@@ -90,17 +90,17 @@ add_task(function visits_query() {
       PlacesUtils.tagging.untagURI(uri, ["test-tag"]);
       Assert.equal(node.tags, null);
     }
   });
 });
 
 add_task(function bookmarks_query() {
   let [query, options] = newQueryWithOptions();
-  query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.unfiledGuid]);
   testQueryContents(query, options, function(root) {
     compareArrayToResult([gTestData[0], gTestData[1], gTestData[2]], root);
     for (let i = 0; i < root.childCount; i++) {
       let node = root.getChild(i);
       let uri = NetUtil.newURI(node.uri);
       Assert.equal(node.tags, null);
       PlacesUtils.tagging.tagURI(uri, ["test-tag"]);
       Assert.equal(node.tags, "test-tag");
--- a/toolkit/components/places/tests/queries/test_onlyBookmarked.js
+++ b/toolkit/components/places/tests/queries/test_onlyBookmarked.js
@@ -42,17 +42,17 @@ var testData = [
 
 
 add_task(async function test_onlyBookmarked() {
   // This function in head_queries.js creates our database with the above data
   await task_populateDB(testData);
 
   // Query
   var query = PlacesUtils.history.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   query.onlyBookmarked = true;
 
   // query options
   var options = PlacesUtils.history.getNewQueryOptions();
   options.queryType = options.QUERY_TYPE_HISTORY;
 
   // Results - this gets the result set and opens it for reading and modification.
   var result = PlacesUtils.history.executeQuery(query, options);
--- a/toolkit/components/places/tests/queries/test_options_inherit.js
+++ b/toolkit/components/places/tests/queries/test_options_inherit.js
@@ -40,17 +40,17 @@ add_task(async function() {
   await test_query({ expandQueries: false }, 3, 3, 0);
   await test_query({ excludeItems: true }, 1, 1, 0);
   await test_query({ excludeItems: true, expandQueries: false }, 1, 1, 0);
   await test_query({ excludeItems: true, excludeQueries: true }, 1, 0, 0);
 });
 
 async function test_query(opts, expectedRootCc, expectedFolderCc, expectedQueryCc) {
   let query = PlacesUtils.history.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.unfiledGuid]);
   let options = PlacesUtils.history.getNewQueryOptions();
   for (const [o, v] of Object.entries(opts)) {
     info(`Setting ${o} to ${v}`);
     options[o] = v;
   }
   let root = PlacesUtils.history.executeQuery(query, options).root;
   root.containerOpen = true;
 
--- a/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
+++ b/toolkit/components/places/tests/queries/test_queryMultipleFolder.js
@@ -42,17 +42,17 @@ add_task(async function test_queryMultip
     let node = rootNode.getChild(i);
     Assert.equal(bookmarkGuids[i], node.bookmarkGuid, node.uri);
   }
   rootNode.containerOpen = false;
 
   // using getNewQuery and getNewQueryOptions
   query = PlacesUtils.history.getNewQuery();
   options = PlacesUtils.history.getNewQueryOptions();
-  query.setParents(folderGuids, folderGuids.length);
+  query.setParents(folderGuids);
   options.sortingMode = options.SORT_BY_URI_ASCENDING;
   options.maxResults = maxResults;
   rootNode = PlacesUtils.history.executeQuery(query, options).root;
   rootNode.containerOpen = true;
   resultLength = rootNode.childCount;
   Assert.equal(resultLength, maxResults);
   for (let i = 0; i < resultLength; ++i) {
     let node = rootNode.getChild(i);
@@ -75,17 +75,17 @@ add_task(async function test_queryMultip
     let node = rootNode.getChild(i);
     Assert.equal(bookmarkGuids[i], node.bookmarkGuid, node.uri);
   }
   rootNode.containerOpen = false;
 
   // using getNewQuery and getNewQueryOptions
   query = PlacesUtils.history.getNewQuery();
   options = PlacesUtils.history.getNewQueryOptions();
-  query.setParents(folderGuids, folderGuids.length);
+  query.setParents(folderGuids);
   options.sortingMode = options.SORT_BY_URI_ASCENDING;
   options.maxResults = maxResults;
   rootNode = PlacesUtils.history.executeQuery(query, options).root;
   rootNode.containerOpen = true;
   resultLength = rootNode.childCount;
   Assert.equal(resultLength, maxResults);
   for (let i = 0; i < resultLength; ++i) {
     let node = rootNode.getChild(i);
--- a/toolkit/components/places/tests/queries/test_querySerialization.js
+++ b/toolkit/components/places/tests/queries/test_querySerialization.js
@@ -226,24 +226,24 @@ const querySwitches = [
       for (let i = 0; i < q2Parents.length; i++) {
         if (!q1Parents.includes(q2Parents[i]))
           return false;
       }
       return true;
     },
     runs: [
       function(aQuery, aQueryOptions) {
-        aQuery.setParents([], 0);
+        aQuery.setParents([]);
       },
       function(aQuery, aQueryOptions) {
-        aQuery.setParents([PlacesUtils.bookmarks.rootGuid], 1);
+        aQuery.setParents([PlacesUtils.bookmarks.rootGuid]);
       },
       function(aQuery, aQueryOptions) {
         aQuery.setParents([PlacesUtils.bookmarks.rootGuid,
-                           PlacesUtils.bookmarks.tagsGuid], 2);
+                           PlacesUtils.bookmarks.tagsGuid]);
       },
     ],
   },
   // tags
   {
     desc:    "nsINavHistoryQuery.getTags",
     matches(aQuery1, aQuery2) {
       if (aQuery1.tagsAreNot !== aQuery2.tagsAreNot)
--- a/toolkit/components/places/tests/queries/test_search_tags.js
+++ b/toolkit/components/places/tests/queries/test_search_tags.js
@@ -22,17 +22,17 @@ add_task(async function test_search_for_
   // tag the bookmarked URI
   PlacesUtils.tagging.tagURI(uri(testURI), ["elephant", "walrus", "giraffe", "turkey", "hiPPo", "BABOON", "alf"]);
 
   // search for the bookmark, using a tag
   var query = PlacesUtils.history.getNewQuery();
   query.searchTerms = "elephant";
   var options = PlacesUtils.history.getNewQueryOptions();
   options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
-  query.setParents([folder.guid], 1);
+  query.setParents([folder.guid]);
 
   var result = PlacesUtils.history.executeQuery(query, options);
   var rootNode = result.root;
   rootNode.containerOpen = true;
 
   Assert.equal(rootNode.childCount, 1);
   Assert.equal(rootNode.getChild(0).bookmarkGuid, bookmark.guid);
   rootNode.containerOpen = false;
--- a/toolkit/components/places/tests/queries/test_sorting.js
+++ b/toolkit/components/places/tests/queries/test_sorting.js
@@ -39,17 +39,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -110,17 +110,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -208,17 +208,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -313,17 +313,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
     var root = result.root;
@@ -411,17 +411,17 @@ tests.push({
       { uri: uri("http://example.com/c"), transition: TRANSITION_TYPED, visitDate: timeInMicroseconds },
       { uri: uri("http://example.com/c"), transition: TRANSITION_TYPED, visitDate: timeInMicroseconds },
     ]);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -499,17 +499,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -595,17 +595,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
@@ -693,17 +693,17 @@ tests.push({
 
     // This function in head_queries.js creates our database with the above data
     await task_populateDB(this._unsortedData);
   },
 
   check() {
     // Query
     var query = PlacesUtils.history.getNewQuery();
-    query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+    query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
     query.onlyBookmarked = true;
 
     // query options
     var options = PlacesUtils.history.getNewQueryOptions();
     options.sortingMode = this._sortingMode;
 
     // Results - this gets the result set and opens it for reading and modification.
     var result = PlacesUtils.history.executeQuery(query, options);
--- a/toolkit/components/places/tests/unit/test_331487.js
+++ b/toolkit/components/places/tests/unit/test_331487.js
@@ -43,17 +43,17 @@ add_task(async function test_hierarchica
   // bookmark query that should result in the "hierarchical" result
   // because there is one query, one folder,
   // no begin time, no end time, no domain, no uri, no search term
   // and no max results.  See GetSimpleBookmarksQueryFolder()
   // for more details.
   var options = histsvc.getNewQueryOptions();
   options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
   var query = histsvc.getNewQuery();
-  query.setParents([folderGuid], 1);
+  query.setParents([folderGuid]);
   var result = histsvc.executeQuery(query, options);
   var root = result.root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 2);
   Assert.equal(root.getChild(0).bookmarkGuid, b1);
   Assert.equal(root.getChild(1).bookmarkGuid, sf1);
 
   // check the contents of the subfolder
@@ -76,17 +76,17 @@ add_task(async function test_hierarchica
   root.containerOpen = false;
 
   // bookmark query that should result in a flat list
   // because we specified max results
   options = histsvc.getNewQueryOptions();
   options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
   options.maxResults = 10;
   query = histsvc.getNewQuery();
-  query.setParents([folderGuid], 1);
+  query.setParents([folderGuid]);
   result = histsvc.executeQuery(query, options);
   root = result.root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 3);
   Assert.equal(root.getChild(0).bookmarkGuid, b1);
   Assert.equal(root.getChild(1).bookmarkGuid, b2);
   Assert.equal(root.getChild(2).bookmarkGuid, b3);
   root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
+++ b/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
@@ -9,17 +9,17 @@ var histsvc = Cc["@mozilla.org/browser/n
               getService(Ci.nsINavHistoryService);
 var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
               getService(Ci.nsITaggingService);
 
 add_task(async function test_query_node_tags_property() {
   // get toolbar node
   var options = histsvc.getNewQueryOptions();
   var query = histsvc.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var result = histsvc.executeQuery(query, options);
   var toolbarNode = result.root;
   toolbarNode.containerOpen = true;
 
   // add a bookmark
   var bookmarkURI = uri("http://foo.com");
   let bookmark = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
--- a/toolkit/components/places/tests/unit/test_433317_query_title_update.js
+++ b/toolkit/components/places/tests/unit/test_433317_query_title_update.js
@@ -17,17 +17,17 @@ add_task(async function test_query_title
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     title: "test query",
     url: "place:",
   });
 
   // query for that query
   var options = histsvc.getNewQueryOptions();
   let query = histsvc.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var result = histsvc.executeQuery(query, options);
   var root = result.root;
   root.containerOpen = true;
   var queryNode = root.getChild(0);
   Assert.equal(queryNode.title, "test query");
 
   // change the title
   await PlacesUtils.bookmarks.update({
--- a/toolkit/components/places/tests/unit/test_433525_hasChildren_crash.js
+++ b/toolkit/components/places/tests/unit/test_433525_hasChildren_crash.js
@@ -34,17 +34,17 @@ add_task(async function test_execute() {
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     title: "test query",
     url: queryURI,
   });
 
   // query for that query
   options = histsvc.getNewQueryOptions();
   query = histsvc.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   result = histsvc.executeQuery(query, options);
   root = result.root;
   root.containerOpen = true;
   var queryNode = root.getChild(0);
   Assert.equal(queryNode.title, "test query");
   queryNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
   Assert.equal(queryNode.hasChildren, true);
   root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_broken_folderShortcut_result.js
+++ b/toolkit/components/places/tests/unit/test_broken_folderShortcut_result.js
@@ -19,17 +19,17 @@ add_task(async function test_brokenFolde
     }],
   });
 
   // Add also a simple visit.
   await PlacesTestUtils.addVisits(uri(("http://3.moz.org/")));
 
   // Query containing a broken folder shortcuts among results.
   let query = PlacesUtils.history.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.unfiledGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.unfiledGuid]);
   let options = PlacesUtils.history.getNewQueryOptions();
   let root = PlacesUtils.history.executeQuery(query, options).root;
   root.containerOpen = true;
 
   Assert.equal(root.childCount, 4);
 
   let shortcut = root.getChild(1);
   Assert.equal(shortcut.uri, "place:parent=1234");
@@ -50,24 +50,24 @@ add_task(async function test_brokenFolde
   // Remove the broken shortcut while the containing result is open.
   await PlacesUtils.bookmarks.remove(bookmarks[2]);
   Assert.equal(root.childCount, 2);
 
   root.containerOpen = false;
 
   // Broken folder shortcut as root node.
   query = PlacesUtils.history.getNewQuery();
-  query.setParents([1234], 1);
+  query.setParents([1234]);
   options = PlacesUtils.history.getNewQueryOptions();
   root = PlacesUtils.history.executeQuery(query, options).root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 0);
   root.containerOpen = false;
 
   // Broken folder shortcut as root node with folder=-1.
   query = PlacesUtils.history.getNewQuery();
-  query.setParents([-1], 1);
+  query.setParents([-1]);
   options = PlacesUtils.history.getNewQueryOptions();
   root = PlacesUtils.history.executeQuery(query, options).root;
   root.containerOpen = true;
   Assert.equal(root.childCount, 0);
   root.containerOpen = false;
 });
--- a/toolkit/components/places/tests/unit/test_getChildIndex.js
+++ b/toolkit/components/places/tests/unit/test_getChildIndex.js
@@ -26,17 +26,17 @@ add_task(async function test_get_child_i
   // Get the unfiled bookmark node.
   let unfiledNode = getNodeAt(PlacesUtils.bookmarks.unfiledGuid, 0);
   if (!unfiledNode)
     do_throw("Unable to find bookmark in hierarchy!");
   Assert.equal(unfiledNode.title, "Unfiled bookmark");
 
   let hs = PlacesUtils.history;
   let query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.menuGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.menuGuid]);
   let options = hs.getNewQueryOptions();
   options.queryType = options.QUERY_TYPE_BOOKMARKS;
   let root = hs.executeQuery(query, options).root;
   root.containerOpen = true;
 
   // Check functionality for proper nodes.
   for (let i = 0; i < root.childCount; i++) {
     let node = root.getChild(i);
@@ -53,17 +53,17 @@ add_task(async function test_get_child_i
   }
 
   root.containerOpen = false;
 });
 
 function getNodeAt(aFolderGuid, aIndex) {
   let hs = PlacesUtils.history;
   let query = hs.getNewQuery();
-  query.setParents([aFolderGuid], 1);
+  query.setParents([aFolderGuid]);
   let options = hs.getNewQueryOptions();
   options.queryType = options.QUERY_TYPE_BOOKMARKS;
   let root = hs.executeQuery(query, options).root;
   root.containerOpen = true;
   if (root.childCount < aIndex)
     do_throw("Not enough children to find bookmark!");
   let node = root.getChild(aIndex);
   root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
+++ b/toolkit/components/places/tests/unit/test_nsINavHistoryViewer.js
@@ -130,17 +130,17 @@ add_task(async function check_history_qu
   result.removeObserver(resultObserver);
   resultObserver.reset();
   await PlacesTestUtils.promiseAsyncUpdates();
 });
 
 add_task(async function check_bookmarks_query() {
   let options = PlacesUtils.history.getNewQueryOptions();
   let query = PlacesUtils.history.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.menuGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.menuGuid]);
   let result = PlacesUtils.history.executeQuery(query, options);
   result.addObserver(resultObserver);
   let root = result.root;
   root.containerOpen = true;
 
   Assert.notEqual(resultObserver.openedContainer, null);
 
   // nsINavHistoryResultObserver.nodeInserted
--- a/toolkit/components/places/tests/unit/test_placeURIs.js
+++ b/toolkit/components/places/tests/unit/test_placeURIs.js
@@ -5,12 +5,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function run_test() {
   // TODO: Improve testing coverage for QueryToQueryString and QueryStringToQuery
 
   // Bug 376798
   let query = PlacesUtils.history.getNewQuery();
   let options = PlacesUtils.history.getNewQueryOptions();
-  query.setParents([PlacesUtils.bookmarks.rootGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.rootGuid]);
   Assert.equal(PlacesUtils.history.queryToQueryString(query, options),
                `place:parent=${PlacesUtils.bookmarks.rootGuid}`);
 }
--- a/toolkit/components/places/tests/unit/test_tagging.js
+++ b/toolkit/components/places/tests/unit/test_tagging.js
@@ -8,17 +8,17 @@
 // service and restart it.
 var tagssvc = Cc["@mozilla.org/browser/tagging-service;1"].
               createInstance().QueryInterface(Ci.nsITaggingService);
 
 function run_test() {
   var options = PlacesUtils.history.getNewQueryOptions();
   var query = PlacesUtils.history.getNewQuery();
 
-  query.setParents([PlacesUtils.bookmarks.tagsGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.tagsGuid]);
   var result = PlacesUtils.history.executeQuery(query, options);
   var tagRoot = result.root;
   tagRoot.containerOpen = true;
 
   Assert.equal(tagRoot.childCount, 0);
 
   var uri1 = uri("http://foo.tld/");
   var uri2 = uri("https://bar.tld/");
--- a/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
+++ b/toolkit/components/places/tests/unit/test_utils_getURLsForContainerNode.js
@@ -30,17 +30,17 @@ add_task(async function test_getURLsForC
           url: "place:sort=1",
           title: "inside query",
         }],
       }],
     }],
   });
 
   var query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = hs.getNewQueryOptions();
 
   info("Check folder without uri nodes");
   check_uri_nodes(query, options, 0);
 
   info("Check folder with uri nodes");
   // Add an uri node, this should be considered.
   await PlacesUtils.bookmarks.insert({
@@ -70,17 +70,17 @@ add_task(async function test_getURLsForC
           url: "place:sort=1",
           title: "inside query",
         }],
       }],
     }],
   });
 
   var query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = hs.getNewQueryOptions();
   options.excludeItems = true;
 
   info("Check folder without uri nodes");
   check_uri_nodes(query, options, 0);
 
   info("Check folder with uri nodes");
   // Add an uri node, this should be considered.
@@ -113,17 +113,17 @@ add_task(async function test_getURLsForC
       children: [{
         url: "place:sort=1",
         title: "inside query",
       }],
     }],
   });
 
   var query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = hs.getNewQueryOptions();
 
   info("Check query without uri nodes");
   check_uri_nodes(query, options, 0);
 
   info("Check query with uri nodes");
   // Add an uri node, this should be considered.
   await PlacesUtils.bookmarks.insert({
@@ -155,17 +155,17 @@ add_task(async function test_getURLsForC
       children: [{
         url: "place:sort=1",
         title: "inside query",
       }],
     }],
   });
 
   var query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = hs.getNewQueryOptions();
   options.excludeItems = true;
 
   info("Check folder without uri nodes");
   check_uri_nodes(query, options, 0);
 
   info("Check folder with uri nodes");
   // Add an uri node, this should be considered.
@@ -198,17 +198,17 @@ add_task(async function test_getURLsForC
       children: [{
         url: "place:sort=1",
         title: "inside query",
       }],
     }],
   });
 
   var query = hs.getNewQuery();
-  query.setParents([PlacesUtils.bookmarks.toolbarGuid], 1);
+  query.setParents([PlacesUtils.bookmarks.toolbarGuid]);
   var options = hs.getNewQueryOptions();
   options.expandQueries = false;
 
   info("Check folder without uri nodes");
   check_uri_nodes(query, options, 0);
 
   info("Check folder with uri nodes");
   // Add an uri node, this should be considered.