Bug 1226443 P5 Always use first scheduled update timer instead of rescheduling on new events. r=ehsan

This commit is contained in:
Ben Kelly 2015-12-11 14:53:11 -05:00
parent a878b0eee8
commit 4c714c7843

View File

@ -4854,14 +4854,17 @@ ServiceWorkerManager::ScheduleUpdateTimer(nsIPrincipal* aPrincipal,
nsCOMPtr<nsITimer> timer = data->mUpdateTimers.Get(aScope);
if (timer) {
timer->Cancel();
data->mUpdateTimers.Remove(aScope);
} else {
// There is already a timer scheduled. In this case just use the original
// schedule time. We don't want to push it out to a later time since that
// could allow updates to be starved forever if events are continuously
// fired.
return;
}
timer = do_CreateInstance("@mozilla.org/timer;1", &rv);
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
}
nsCOMPtr<nsITimerCallback> callback = new UpdateTimerCallback(aPrincipal,
aScope);