Bug 1329006 Make RescheduleTimeouts() deadlines correctly for suspended windows. r=smaug a=jcristau
authorBen Kelly <ben@wanderview.com>
Mon, 09 Jan 2017 14:08:18 -0800
changeset 353449 10e1849db4be083d35c4e40a7d7a7b32a0437817
parent 353448 1c8a9f489bb4bf063b1502222a4cda953d80d7f6
child 353450 29165fb690044f72c1d0265be4727bec83c4544f
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jcristau
bugs1329006
milestone52.0a2
Bug 1329006 Make RescheduleTimeouts() deadlines correctly for suspended windows. r=smaug a=jcristau
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -13058,21 +13058,23 @@ nsGlobalWindow::RescheduleTimeout(Timeou
   // And make sure delay is nonnegative; that might happen if the timer
   // thread is firing our timers somewhat early or if they're taking a long
   // time to run the callback.
   if (delay < TimeDuration(0)) {
     delay = TimeDuration(0);
   }
 
   if (!aTimeout->mTimer) {
-    NS_ASSERTION(IsFrozen() || IsSuspended(),
-                 "How'd our timer end up null if we're not frozen or "
-                 "suspended?");
-
-    aTimeout->mTimeRemaining = delay;
+    if (IsFrozen()) {
+      aTimeout->mTimeRemaining = delay;
+    } else if (IsSuspended()) {
+      aTimeout->mWhen = currentNow + delay;
+    } else {
+      MOZ_ASSERT_UNREACHABLE("Window should be frozen or suspended.");
+    }
     return true;
   }
 
   aTimeout->mWhen = currentNow + delay;
 
   // Reschedule the OS timer. Don't bother returning any error codes if
   // this fails since the callers of this method don't care about them.
   nsresult rv = aTimeout->InitTimer(GetThrottledEventQueue(),