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

Normative spec doesn't necessarily terminate service workers #54

Open
asakusuma opened this issue Nov 1, 2018 · 3 comments
Open

Normative spec doesn't necessarily terminate service workers #54

asakusuma opened this issue Nov 1, 2018 · 3 comments

Comments

@asakusuma
Copy link

I don't think the normative behavior of the storage directive provides the guarantees stated in the non-normative language, specifically around service workers.

Service Workers registered for an origin are terminated and deregistered.

From what I can tell, the spec says to simply call unregister() on every service worker registration for the matching origin. unregister() doesn't actually take effect until no client is using the registration. Even if reloading() did create a point in time in which the client was not using the registration, I'm not sure that iterating over each client and calling reload() will guarantee that there was a point in time in which no client was using the registration. Perhaps the Clear Registration algorithm should be invoked directly?

Original discussion: w3c/ServiceWorker#614
Related ticket: #1

@asakusuma
Copy link
Author

FWIW, I've tested Clear-Site-Data: storage in Chrome 73 and Firefox 65, they both kick the service worker immediately, rather than waiting until no client is using the registration.

@jungkees
Copy link

jungkees commented Jun 5, 2019

For the spec language, I think we should use:

  1. Remove scope to registration map[registration's scope url].
  2. Invoke Clear Registration with registration.

Note that w3c/ServiceWorker#1415 moves the map entry removal step out of Clear Registration. So we need it to be merged before using the above steps.

/cc @jakearchibald, @matto, @asutherland, @SteveBeckerMSFT

asakusuma added a commit to asakusuma/ServiceWorker that referenced this issue Jun 21, 2019
So that the Clear Site Data spec can reference the algorithm and use
it to clear out the service worker, insteaed of unregister().

Context:
w3c#614 (comment)

Eventually will resolve:
w3c/webappsec-clear-site-data#54
jungkees added a commit to jungkees/webappsec-clear-site-data that referenced this issue Feb 26, 2020
Clear-Site-Data: "storage" has used Service Workers' unregister() as
Service Workers' had no external algorithm that allows immediate purging
of the service worker registrations. This change calls into Purging
Service Worker Reigstration algorithm defined in Service Workers with
the origin and intention to unclaim the controlled clients when
"storage" directive is specified.

Issue: w3c#54.
Service Workers issue: w3c/ServiceWorker#614.
Service Workers PR: w3c/ServiceWorker#1506.
@asutherland
Copy link

We noticed that as of WebKit build 171 Safari now passes all of the tests in https://github.com/web-platform-tests/wpt/blob/master/clear-site-data/storage.https.html which includes causing controlled pages to become uncontrolled, consistent with the cluster of issues associated with this one.

I can confirm for Firefox/Gecko that we believe the test behavior (and what's been proposed in this cluster) seems appropriate and consistent with previous discussions in the ServiceWorkers WG about CSD being an emergency kill-switch for ServiceWorkers, etc. and that we should go ahead with the spec changes to normalize this.

@youennf @cdumez From the reference to this issue in WebKit/WebKit#14032 and the decision to land the underlying WebKit change, I assume WebKit also believes we should specify the behavior of making controlled clients become uncontrolled?

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

No branches or pull requests

3 participants