Commit f3c605ba authored by Ben Kelly's avatar Ben Kelly
Browse files

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

parent 13b10493
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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;
  }

+1 −1
Original line number Diff line number Diff line
@@ -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);
  }