Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Kill Service Workers algorithm #1440

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asakusuma
Copy link

@asakusuma asakusuma commented Jun 23, 2019

Intended to be a killswitch mechanism for all service workers associated with an origin. In the short term, designed to be used directly by Clear Site Data.

  1. "Unclaim" all service workers for the origin. In other words, ensure no clients are controlled by any service worker under the origin
  2. Terminate all in-flight tasks, but allow fetch tasks to fallback to network
  3. Immediately unregister all registrations under the origin

Context:
#614 (comment)

Eventually will resolve:
w3c/webappsec-clear-site-data#54

cc @jungkees @mattto @jakearchibald


Preview | Diff

Intended to be a killswitch mechanism for all service workers associated with an origin.

1. "Unclaim" all service workers for the origin. In other words, ensure no clients are controlled by any service worker under the origin
2. Terminate all in-flight tasks, but allow fetch tasks to fallback to network
3. Immediately unregister all registrations under the origin
@jakearchibald
Copy link
Contributor

I'm digging into this. It feels like we need to define what happens when various algorithms are cancelled halfway through. Eg, what happens if a service worker is killed half way through install, fetch, etc.

@asakusuma
Copy link
Author

asakusuma commented Jun 26, 2019

I agree that we need to define what happens to in-flight tasks. However, for the purpose of a killswitch, it would be nice if that definition was centralized/global, rather than relying on the individual design of each algorithm. Is it possible to just drop every task on the floor, have fetches fallback to network, nuke a top level state container, and let GC do its thing?

@asakusuma
Copy link
Author

asakusuma commented Jun 27, 2019

TODO:

  • Either specify a time limit for pending promises, or update wait until language to allow killing pending promises without a grace period
  • Close any notifications associated with service workers
  • Terminate any running background fetches

@jakearchibald
Copy link
Contributor

We'd also need to do something about ongoing background fetches.

This is why I think we need to spec this a little more explicitly rather than try and hand-wave it.

However, these aren't problems created by Clear Site Data. We just haven't been clear about how registrations are cleaned up so far.

@asakusuma
Copy link
Author

Makes sense. I've added the background fetches to the TODO.

I'm hoping we can apply the fetch group concept and do something similar for service workers.

Base automatically changed from master to main February 4, 2021 19:56
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.

2 participants