Bug 1281730 Restore timeouts before thawing workers to avoid running script on frozen timers. r=khuey

This commit is contained in:
Ben Kelly 2016-07-04 06:49:29 -07:00
Родитель 867e2c403e
Коммит 498431cc2a
1 изменённых файлов: 9 добавлений и 7 удалений

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

@ -13078,13 +13078,6 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren, bool aThawWorkers)
RefPtr<Promise> d = mAudioContexts[i]->Resume(dummy); RefPtr<Promise> d = mAudioContexts[i]->Resume(dummy);
} }
// Thaw or resume all of the workers for this window.
if (aThawWorkers) {
mozilla::dom::workers::ThawWorkersForWindow(AsInner());
} else {
mozilla::dom::workers::ResumeWorkersForWindow(AsInner());
}
// Restore all of the timeouts, using the stored time remaining // Restore all of the timeouts, using the stored time remaining
// (stored in timeout->mTimeRemaining). // (stored in timeout->mTimeRemaining).
@ -13129,6 +13122,15 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren, bool aThawWorkers)
// Add a reference for the new timer's closure. // Add a reference for the new timer's closure.
t->AddRef(); t->AddRef();
} }
// Thaw or resume all of the workers for this window. We must do this
// after timeouts since workers may have queued events that can trigger
// a setTimeout().
if (aThawWorkers) {
mozilla::dom::workers::ThawWorkersForWindow(AsInner());
} else {
mozilla::dom::workers::ResumeWorkersForWindow(AsInner());
}
} }
// Resume our children as well. // Resume our children as well.