Bug 1290116 P3 Delay removing registration until active worker is idle. r=asuth

This commit is contained in:
Ben Kelly 2016-08-18 07:12:09 -07:00
Родитель 1340a14939
Коммит 846726fe4d
2 изменённых файлов: 11 добавлений и 4 удалений

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

@ -1304,9 +1304,16 @@ ServiceWorkerManager::WorkerIsIdle(ServiceWorkerInfo* aWorker)
return;
}
if (reg->GetActive() == aWorker) {
reg->TryToActivateAsync();
if (reg->GetActive() != aWorker) {
return;
}
if (!reg->IsControllingDocuments() && reg->mPendingUninstall) {
RemoveRegistration(reg);
return;
}
reg->TryToActivateAsync();
}
already_AddRefed<ServiceWorkerJobQueue>
@ -2001,7 +2008,7 @@ void
ServiceWorkerManager::StopControllingADocument(ServiceWorkerRegistrationInfo* aRegistration)
{
aRegistration->StopControllingADocument();
if (aRegistration->IsControllingDocuments()) {
if (aRegistration->IsControllingDocuments() || !aRegistration->IsIdle()) {
return;
}

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

@ -139,7 +139,7 @@ ServiceWorkerUnregisterJob::Unregister()
InvokeResultCallbacks(NS_OK);
// "If no service worker client is using registration..."
if (!registration->IsControllingDocuments()) {
if (!registration->IsControllingDocuments() && registration->IsIdle()) {
// "Invoke [[Clear Registration]]..."
swm->RemoveRegistration(registration);
}