Bug 1329006 Make RescheduleTimeouts() deadlines correctly for suspended windows. r=smaug

This commit is contained in:
Ben Kelly 2017-01-06 11:24:43 -08:00
Родитель bbf01a2d5f
Коммит 35c6feb9f3
1 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -716,11 +716,20 @@ TimeoutManager::RescheduleTimeout(Timeout* aTimeout, const TimeStamp& now,
}
if (!aTimeout->mTimer) {
NS_ASSERTION(mWindow.IsFrozen() || mWindow.IsSuspended(),
"How'd our timer end up null if we're not frozen or "
"suspended?");
aTimeout->mTimeRemaining = delay;
if (mWindow.IsFrozen()) {
// If we are frozen simply set timeout->mTimeRemaining to be the
// "time remaining" in the timeout (i.e., the interval itself). This
// will be used to create a new mWhen time when the window is thawed.
// The end effect is that time does not appear to pass for frozen windows.
aTimeout->mTimeRemaining = delay;
} else if (mWindow.IsSuspended()) {
// Since we are not frozen we must set a precise mWhen target wakeup
// time. Even if we are suspended we want to use this target time so
// that it appears time passes while suspended.
aTimeout->mWhen = currentNow + delay;
} else {
MOZ_ASSERT_UNREACHABLE("Window should be frozen or suspended.");
}
return true;
}