Unregister a service worker when another tab is controlled by it can "resurrect" it (Chrome)
Open
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 3.6k
- Forks
- 324
- Avg merge
- 14d 22h
- Merged PRs (30d)
- 1
Description
Repro steps:
- open 2 tabs controlled by the same service worker
- with the inspector opened, unregister the service worker (or do that in the console if u prefer)
- the service worker is now flagged as deleted
- if u just reload 1 of the tab, the reloaded tab will not be controlled, but the service worker is not flagged as deleted anymore
- note that it's not like a new service worker is installed, the "id" displayed in the inspector is the same
- this is why I say it's resurrected
This of course makes it hard to properly unregister a service worker unless u reload all the clients.
This is what I'm doing, but I wonder if this bug can still happen if a client reload with a bit of delay, leading to the old service worker resurrection.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two-tab scenario in Chrome with the inspector or console, then inspect the service worker lifecycle around unregistering and delayed client reloads. The issue is done when the resurrection behavior is confirmed or ruled out and the expected behavior for remaining controlled clients is clearly established.
Written by the indexing model from the issue text.
Assessment
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100