Skip to content

Do not keep service workers alive via prefetch clients - #409

Open
domenic wants to merge 2 commits into
mainfrom
sw-keepalive
Open

Do not keep service workers alive via prefetch clients#409
domenic wants to merge 2 commits into
mainfrom
sw-keepalive

Conversation

@domenic

@domenic domenic commented Sep 11, 2025

Copy link
Copy Markdown
Collaborator

Fixes #347: the "clients" created during prefetch time no longer count as controlling pages, in a way that prevents service worker updates. We may still want to consider evicting prefetch records on service worker updates (as discussed in #351), but that can be done as an additional step on top of this.

@domenic
domenic requested a review from hiroshige-g September 11, 2025 04:52
@github-actions

Copy link
Copy Markdown
Preview:

@hiroshige-g

Copy link
Copy Markdown
Collaborator

Given that #347 (comment) #347 (comment), I feel I'm not yet fully confident that this is implementable right now so prefer to keep this unresolved (until we get bandwidth/priority to investigate/implement this).

Also @yoshisatoyanagisawa, WDYT?

@yoshisatoyanagisawa

Copy link
Copy Markdown

For the implementation wise, it might be similar position with BFCache. Trade-offs between correctness and performance might also be the same with it.
As a first step, excluding prefetch from the reason to prevent ServiceWorker update sounds reasonable to me. However, we need to discuss if we discard prefetched data.

Fixes #347: the "clients" created during prefetch time no longer count as controlling pages, in a way that prevents service worker updates. We may still want to consider evicting prefetch records on service worker updates (as discussed in #351), but that can be done as an additional step on top of this.
@domenic

domenic commented Sep 17, 2025

Copy link
Copy Markdown
Collaborator Author

I've pushed a second commit that clears existing prefetch records on update, to implement (C) of #347 (comment) per @yoshisatoyanagisawa's recommendation in #347 (comment).

I am not sure I understood the best place in the service worker spec to insert that step, so careful review is appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefetch requests keeping the service worker alive and preventing it from revving its version

3 participants