Bug 1456995 - shutdown unregistered Service Workers on browser shutdown r=asuth

Also replace ServiceWorkerManager shutdown logic's normal for-loops with
range-based for-loops.

Differential Revision: https://phabricator.services.mozilla.com/D48179

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Perry Jiang 2019-10-08 23:47:57 +00:00
Родитель 289cec9298
Коммит b3b727b8ee
1 изменённых файлов: 17 добавлений и 16 удалений

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

@ -486,26 +486,27 @@ void ServiceWorkerManager::MaybeStartShutdown() {
mShuttingDown = true;
for (auto it1 = mRegistrationInfos.Iter(); !it1.Done(); it1.Next()) {
for (auto it2 = it1.UserData()->mUpdateTimers.Iter(); !it2.Done();
it2.Next()) {
nsCOMPtr<nsITimer> timer = it2.UserData();
timer->Cancel();
}
it1.UserData()->mUpdateTimers.Clear();
for (auto& entry : mRegistrationInfos) {
auto& dataPtr = entry.GetData();
for (auto it2 = it1.UserData()->mJobQueues.Iter(); !it2.Done();
it2.Next()) {
RefPtr<ServiceWorkerJobQueue> queue = it2.UserData();
queue->CancelAll();
for (auto& timerEntry : dataPtr->mUpdateTimers) {
timerEntry.GetData()->Cancel();
}
it1.UserData()->mJobQueues.Clear();
dataPtr->mUpdateTimers.Clear();
for (auto it2 = it1.UserData()->mInfos.Iter(); !it2.Done(); it2.Next()) {
RefPtr<ServiceWorkerRegistrationInfo> regInfo = it2.UserData();
regInfo->ShutdownWorkers();
for (auto& queueEntry : dataPtr->mJobQueues) {
queueEntry.GetData()->CancelAll();
}
it1.UserData()->mInfos.Clear();
dataPtr->mJobQueues.Clear();
for (auto& registrationEntry : dataPtr->mInfos) {
registrationEntry.GetData()->ShutdownWorkers();
}
dataPtr->mInfos.Clear();
}
for (auto& entry : mControlledClients) {
entry.GetData()->mRegistrationInfo->ShutdownWorkers();
}
if (mShutdownBlocker) {