Bug 1407245 - Fix service worker update 24-hour time check conversion from microseconds. r=asuth, a=ritu
authorBen Kelly <ben@wanderview.com>
Tue, 10 Oct 2017 13:50:36 -0700
changeset 432681 f3db43c2871f535249156bb5e082885dbd8b2a3d
parent 432680 8b84e5418b809672a7387975d2b780ce60be3a95
child 432682 c703e451d7aa32dfe9ba4b7fc262c4a69234af0b
push id8029
push userryanvm@gmail.com
push dateMon, 23 Oct 2017 18:08:40 +0000
treeherdermozilla-beta@86534d5daeef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth, ritu
bugs1407245
milestone57.0
Bug 1407245 - Fix service worker update 24-hour time check conversion from microseconds. r=asuth, a=ritu
dom/workers/ServiceWorkerRegistrationInfo.cpp
--- a/dom/workers/ServiceWorkerRegistrationInfo.cpp
+++ b/dom/workers/ServiceWorkerRegistrationInfo.cpp
@@ -341,24 +341,24 @@ ServiceWorkerRegistrationInfo::IsLastUpd
   AssertIsOnMainThread();
 
   // For testing.
   if (Preferences::GetBool("dom.serviceWorkers.testUpdateOverOneDay")) {
     return true;
   }
 
   const int64_t kSecondsPerDay = 86400;
-  const int64_t now =
+  const int64_t nowMicros =
     mCreationTime + static_cast<PRTime>((TimeStamp::Now() -
                                          mCreationTimeStamp).ToMicroseconds());
 
   // now < mLastUpdateTime if the system time is reset between storing
   // and loading mLastUpdateTime from ServiceWorkerRegistrar.
-  if (now < mLastUpdateTime ||
-      (now - mLastUpdateTime) / PR_MSEC_PER_SEC > kSecondsPerDay) {
+  if (nowMicros < mLastUpdateTime ||
+      (nowMicros - mLastUpdateTime) / PR_USEC_PER_SEC > kSecondsPerDay) {
     return true;
   }
   return false;
 }
 
 void
 ServiceWorkerRegistrationInfo::AsyncUpdateRegistrationStateProperties(WhichServiceWorker aWorker,
                                                                       TransitionType aTransition)