Bug 1368715 - Ignore and report invalid modified dates in synced bookmark changesets. r?markh draft
authorKit Cambridge <kit@yakshaving.ninja>
Wed, 07 Jun 2017 11:47:00 -0700
changeset 590375 b76bb60b6c9179493ee9c15d32d8b0b6fcfdb605
parent 589150 cad53f061da634a16ea75887558301b77f65745d
child 632215 399558f3f8175d38c87f6bf85493c640e48a98a4
push id62733
push userbmo:kit@mozilla.com
push dateWed, 07 Jun 2017 18:48:45 +0000
reviewersmarkh
bugs1368715
milestone55.0a1
Bug 1368715 - Ignore and report invalid modified dates in synced bookmark changesets. r?markh MozReview-Commit-ID: IM7T7UOt7xf
toolkit/components/places/PlacesSyncUtils.jsm
--- a/toolkit/components/places/PlacesSyncUtils.jsm
+++ b/toolkit/components/places/PlacesSyncUtils.jsm
@@ -1688,17 +1688,23 @@ var fetchQueryItem = async function(book
     item.query = query;
   }
 
   return item;
 };
 
 function addRowToChangeRecords(row, changeRecords) {
   let syncId = BookmarkSyncUtils.guidToSyncId(row.getResultByName("guid"));
-  let modified = row.getResultByName("modified") / MICROSECONDS_PER_SECOND;
+  let modifiedAsPRTime = row.getResultByName("modified");
+  let modified = modifiedAsPRTime / MICROSECONDS_PER_SECOND;
+  if (Number.isNaN(modified) || modified <= 0) {
+    BookmarkSyncLog.error("addRowToChangeRecords: Invalid modified date for " +
+                          syncId, modifiedAsPRTime);
+    modified = 0;
+  }
   changeRecords[syncId] = {
     modified,
     counter: row.getResultByName("syncChangeCounter"),
     status: row.getResultByName("syncStatus"),
     tombstone: !!row.getResultByName("tombstone"),
     synced: false,
   };
 }