set record ID in history store when creating a record
authorDan Mills <thunder@mozilla.com>
Tue, 27 Jan 2009 17:08:47 -0800
changeset 45211 7d5d84c9f9f5fe517633d4ec960584462708b5db
parent 45210 a2b025874da94f754c829cd0a5bfd17bc5050e03
child 45212 0cdb3ba8dd26fd996dbbcde9c758fdd33ab9189e
child 45213 6b7664d3a93bcb6eb8dca43a60a272dcaaa440e9
push idunknown
push userunknown
push dateunknown
set record ID in history store when creating a record
services/sync/modules/engines/history.js
--- a/services/sync/modules/engines/history.js
+++ b/services/sync/modules/engines/history.js
@@ -61,22 +61,22 @@ HistoryEngine.prototype = {
   displayName: "History",
   logName: "History",
   _storeObj: HistoryStore,
   _trackerObj: HistoryTracker,
 
   // History reconciliation is simpler than the default one from SyncEngine,
   // because we have the advantage that we can use the URI as a definitive
   // check for local existence of incoming items.  The steps are as follows:
-  // 
+  //
   // 1) Check for the same item in the locally modified list.  In that case,
   //    local trumps remote.  This step is unchanged from our superclass.
   // 2) Check if the incoming item was deleted.  Skip if so.
   // 3) Apply new record/update.
-  // 
+  //
   // Note that we don't attempt to equalize the IDs, the history store does that
   // as part of update()
   _reconcile: function HistEngine__reconcile(item) {
     let self = yield;
     let ret = true;
 
     // Step 1: Check for conflicts
     //         If same as local record, do not upload
@@ -393,17 +393,17 @@ HistoryStore.prototype = {
       if (curvisits.filter(function(i) i.date == visit.date).length)
         continue;
       this._log.debug("     visit " + visit.date);
       this._hsvc.addVisit(uri, visit.date, null, visit.type,
                           (visit.type == 5 || visit.type == 6), 0);
     }
     this._hsvc.setPageTitle(uri, record.cleartext.title);
 
-    // Equalize IDs 
+    // Equalize IDs
     let localId = this._getGUID(record.cleartext.uri);
     if (localId != record.id)
       this.changeItemID(localId, record.id);
 
   },
 
   itemExists: function HistStore_itemExists(id) {
     if (this._findURLByGUID(id))
@@ -415,16 +415,17 @@ HistoryStore.prototype = {
     if (typeof(url) == "string")
       url = Utils.makeURI(url);
     return this._hsvc.isVisited(url);
   },
 
   createRecord: function HistStore_createRecord(guid) {
     let foo = this._findURLByGUID(guid);
     let record = new HistoryRec();
+    record.id = guid;
     if (foo) {
       record.histUri = foo.url;
       record.title = foo.title;
       record.visits = this._getVisits(record.histUri);
     } else {
       record.cleartext = null; // deleted item
     }
     this.cache.put(guid, record);