Bug 1388149 - Make PlacesUtils.history.insertMany respect provided GUIDs r?markh draft
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Mon, 07 Aug 2017 16:01:10 -0400
changeset 642172 c86f1b0cdbdc5d2af59cda42510329632f41c753
parent 642171 06c9ca99d4618e2d3316218249cc5672dbf70119
child 724923 07a36cd9314f6a136fffaeef9de16ea9ff13aa63
push id72668
push userbmo:tchiovoloni@mozilla.com
push dateMon, 07 Aug 2017 20:01:43 +0000
reviewersmarkh
bugs1388149
milestone57.0a1
Bug 1388149 - Make PlacesUtils.history.insertMany respect provided GUIDs r?markh MozReview-Commit-ID: 7g6uABtHKg2
services/sync/tests/unit/test_history_store.js
toolkit/components/places/History.jsm
--- a/services/sync/tests/unit/test_history_store.js
+++ b/services/sync/tests/unit/test_history_store.js
@@ -132,16 +132,17 @@ add_task(async function test_store_creat
     {id: tbguid,
      histUri: tburi.spec,
      title: "The bird is the word!",
      visits: [{date: TIMESTAMP3,
                type: Ci.nsINavHistoryService.TRANSITION_TYPED}]}
   ]);
   await onVisitObserved;
   try {
+    do_check_true((await store.itemExists(tbguid)));
     do_check_attribute_count(await store.getAllIDs(), 2);
     let queryres = queryHistoryVisits(tburi);
     do_check_eq(queryres.length, 1);
     do_check_eq(queryres[0].time, TIMESTAMP3);
     do_check_eq(queryres[0].title, "The bird is the word!");
   } catch (ex) {
     PlacesTestUtils.clearHistory();
     do_throw(ex);
--- a/toolkit/components/places/History.jsm
+++ b/toolkit/components/places/History.jsm
@@ -705,16 +705,17 @@ this.History = Object.freeze({
  * Note: this assumes that the PageInfo object has already been validated
  * via PlacesUtils.validatePageInfo.
  *
  * @param pageInfo: (PageInfo)
  * @return (info)
  */
 function convertForUpdatePlaces(pageInfo) {
   let info = {
+    guid: pageInfo.guid,
     uri: PlacesUtils.toURI(pageInfo.url),
     title: pageInfo.title,
     visits: [],
   };
 
   for (let inVisit of pageInfo.visits) {
     let visit = {
       visitDate: PlacesUtils.toPRTime(inVisit.date),