Skip to content
WebsiteHosting.com

concept Frontend & browsers

Service worker update, waiting and activation lifecycle

See why a successfully installed service worker can wait while old pages remain open, and why activating the replacement is different from claiming a previously uncontrolled page.

Latest recorded source check · P0180

What it means

A new service worker can install successfully and still wait while the old worker controls open pages. Installation makes the replacement available; activation makes it the active worker for its registration. To understand a delay, count the pages still controlled by the old worker, not every open tab.

Try it

Simulation: One registration has an old active worker and a changed worker that installed successfully. The old worker has finished its outstanding work but still controls two pages. With skipWaiting set to no, the old worker stays active and the new one waits. The simulation does not inspect or change your browser's registrations.

Service worker update, waiting and activation lifecycle

Explain why a new service-worker script may wait while old clients remain open

Simulation
Modeled outcome: Waiting

Activation is delayed by old-worker lifetime work or existing controlled clients.

Service worker update, waiting and activation lifecycle: synthetic scenario inputs
Replaces all inputs with the documented starting example and the indicated change. Reset restores the starting example.
Worker update and client-control boundaries

Lifecycle

  1. Updatechanged
  2. Installsuccess
  3. Old worksettled
  4. Skip waitingno
  5. Outcomewaiting

Clients

  1. Workerold
  2. Waiting workernew
  3. Existing controlled clients2
  4. Newly claimedNot evaluated / established
  5. Eligible uncontrolled remainingNot evaluated / established
  6. Outside scope unchangedNot evaluated / established

Activation and control of eligible clients are different events. A failed installation leaves the old worker in this fixture; no real service worker is registered.

Evaluated inputs

Required scenario evidence
provided
Update observation
changed
Install result
success
Clients controlled by old worker
2 count
Outstanding old-worker lifetime work
settled
skipWaiting requested
no

Not evaluated: Eligible in-scope uncontrolled clients · Outside-scope clients · clients.claim requested after activation

One registration, old active worker not already activating, successful activation assumed after eligibility, all listed claimable clients secure/matching registration, no overlapping updates, event rejection, storage key changes or force-reload. Existing controlled clients and previously uncontrolled clients distinguished. Pending old lifetime work conservatively delays modeled activation. Not a deployment prescription; mixed page/worker versions need compatibility checks.

About this model

The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.

Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.

  1. Change only skipWaiting requested to yes. The new worker now activates despite the two existing controlled pages. Look at the client counts: two were already controlled, zero are newly claimed, one eligible page remains uncontrolled, and one outside-scope page is unchanged.
  2. Leave skipWaiting at yes and change clients.claim requested after activation to yes. The active worker is still the new one. What changes is the previously uncontrolled group: one page is newly claimed, leaving zero eligible pages uncontrolled. The outside-scope page is unaffected.
  3. With both requests still set to yes, change the old worker's outstanding work to pending. The new worker waits in this model. A claim is now not evaluated, which is different from an active worker claiming zero pages.

Reset returns to the original two controlled pages, settled work, both requests set to no, and the new worker waiting.

What has to finish before activation?

First distinguish an update from an installation. If the update observation is unchanged, there is no new worker to install in the example; the selected install result is irrelevant. If the script changed but installation failed, the old worker also stays active, but for a different reason: the replacement did not finish installing. Neither result is a waiting worker. If you don't know whether the script changed, or whether a changed script installed, there's not enough information to say it is waiting.

After a successful install, consider what happens as the old controlled pages close. Starting with two and no skipWaiting, closing one leaves one page under the old worker's control, so the new worker still waits. When the last one closes, the new worker can activate, assuming the old worker's outstanding work has settled. The eligible but uncontrolled page need not close: it was never one of the pages keeping the old worker in place.

skipWaiting changes whether those controlled pages have to go away first; it does not reload them. clients.claim addresses a different question: once the new worker is active, can it take control of a page that was previously uncontrolled? In this example the in-scope page is eligible and matches the registration. The outside-scope page does not become eligible just because the worker is active.

Set skip waiting while old lifetime work is still pending. The modeled waiting worker remains waiting despite that request; clearing the pending work changes the activation gate. Keep pending work separate from the number of controlled clients. A failed install also does not establish any new active worker.

In practice

If an open page still appears to use the old version, check which worker is active for its registration, whether a replacement is actually waiting, and which worker controls that page, if any. If the install result is missing, look for that observation first. If installation succeeded and the replacement is waiting, distinguish remaining controlled pages from unfinished work. A tab count alone tells you neither.

This example follows one update to one registration and assumes activation succeeds once its conditions are met. It does not predict timing, overlapping updates, or the effect of a force-reload. Don't change a real registration on the strength of the example. If the worker states, client relationships, or supported browser version are unknown, stop at observation.

A new active worker and an old open page can coexist. The page may still expect the old assets or message format; changing its controller doesn't rewrite those expectations. Before considering a change to update policy, establish whether that particular page and worker can work together and how you would revert the change. An active worker is evidence of a lifecycle transition, not a compatibility test.

Frequently asked questions

Editorial questions based on the listed sources and explicitly labeled local examples.

Does skipWaiting reload existing pages?

No. It requests activation without waiting for all old controlled clients to go away, subject to activation conditions. It is not a page reload or a guarantee of application compatibility.

Is activation the same as clients.claim?

No. The claim operation is separately scoped to eligible clients of the active registration. It can affect previously uncontrolled clients; it is not permission to control arbitrary pages.

What if installation fails?

The failed update does not replace the active worker through successful installation. Keep old compatibility and investigate the actual install event.

Why be careful with forced activation?

An old page can interact with new worker behavior while retaining old assets or message contracts. The lab separates activation from claiming eligible uncontrolled clients; neither operation verifies compatibility. Plan compatibility and rollback before changing real update policy.

Sources & model boundaries

Primary references used for this explanation. The interactive example is an educational model, not a live check.

  1. Service Workers specification

    Install, Try Activate, Activate. A failed installation makes the installing worker redundant. Activation checks pending lifetime work and controlled clients; skip-waiting changes part of those conditions, not every requirement.

    Checked .

  2. MDN: ServiceWorkerGlobalScope.skipWaiting()

    Description; Examples. skipWaiting advances an installed waiting worker toward activation; claiming existing clients is a separate action. Neither call alone guarantees that old pages and new resources are compatible.

    Checked .

Report an issue. Include the article URL and ID, not passwords or access keys.