-
Notifications
You must be signed in to change notification settings - Fork 312
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
Add ServiceWorkerRegistration.id
and supporting algorithm changes. (Fixes #1512)
#1526
base: main
Are you sure you want to change the base?
Conversation
Hi Ben. There’s some W3C tooling that doesn’t yet recognize you on GitHub, but you can fix it by going to to https://www.w3.org/users/myprofile to log into your W3C account — and from there, follow the Connected Accounts link in the sidebar to connect your W3C account with your GitHub account. |
Marked as non substantive for IPR from ash-nazg. |
Thanks, I've connected my account. |
ServiceWorkerRegistration.id
and supporting algorithm changes. (Fixes #1512)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly prose nits. The only real concern is the backwards compatibility break with reg.scope
.
@@ -208,9 +210,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe | |||
<section dfn-for="service worker registration"> | |||
<h3 id="service-worker-registration-concept">Service Worker Registration</h3> | |||
|
|||
A <dfn export id="dfn-service-worker-registration" for="">service worker registration</dfn> is a tuple of a [=service worker registration/scope url=] and a set of [=/service workers=], an <a>installing worker</a>, a <a>waiting worker</a>, and an <a>active worker</a>. A user agent *may* enable many [=/service worker registrations=] at a single origin so long as the [=service worker registration/scope url=] of the [=/service worker registration=] differs. A [=/service worker registration=] of an identical [=service worker registration/scope url=] when one already exists in the user agent causes the existing [=/service worker registration=] to be replaced. | |||
A <dfn export id="dfn-service-worker-registration" for="">service worker registration</dfn> is a tuple of an [=environment settings object/origin=], an [=service worker registration/id=], and a set of [=/service workers=]; an <a>installing worker</a>, a <a>waiting worker</a>, and an <a>active worker</a>. A user agent *may* enable many [=/service worker registrations=] at a single origin so long as the [=service worker registration/id=] of the [=/service worker registration=] differs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about just removing this paragraph? It doesn't seem to be saying anything that isn't already said elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I can just remove it as it include a <dfn>
tag for "service worker registration".
:: A [=/service worker registration=] | ||
:: A [=/service worker registration=] or null. | ||
|
||
1. Run the following steps atomically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we have this a few places in the spec, but I don't actually know what it means.
@@ -2797,6 +2862,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe | |||
1. If |registration|'s [=active worker=] is not null, then: | |||
1. [=Terminate Service Worker|Terminate=] |registration|'s [=active worker=]. | |||
1. Run the [=Update Worker State=] algorithm passing |registration|'s [=active worker=] and "`redundant`" as the arguments. | |||
1. Let |oldUsingClients| be a [=list=] of [=/service worker clients=] who are <a>using</a> |registration|. | |||
|
|||
Note: We must get the list of clients prior to clearing the old <a>active worker</a> from |registration|. Otherwise the [=/service worker client=] will not be considered to be <a>using</a> |registration| any more since |registration| will no longer be the <a>containing service worker registration</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Thanks for the review @jakearchibald! I will work on addressing this next week after I clear some other things off my TODO list. |
@@ -683,6 +702,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe | |||
</pre> | |||
<pre class="idl" id="registration-option-list-dictionary"> | |||
dictionary RegistrationOptions { | |||
DOMString id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write a test with isolated surrogates to ensure implementations do not use UTF-8 to store these strings. (If you decide to change this to USVString to allow implementations to do that it's probably still worth writing a test.)
…ixes w3c#1512) This commit adds support for a registration `id` value. This will be used to uniquely identify registrations instead of `scope`. This will make it easier for a developer to migrate a registration from one `scope` to another. The commit consists of the following changes: * Add a DOMString `id` and associated getter to the registration. * Add an `origin` to the internal registration type. * Move the `scope` internal representation to `ServiceWorker` and add a new getter. * Make the `ServiceWorkerRegistration.scope` return the oldest associated worker's `scope`. * Migrate the registration map to be keyed by the tuple `(origin,id)`. * Migrate the job queue map to be keyed by the tuple `(origin,id)`. * Adjust job equality checks to treat register jobs to account for new id and scope semantics. * Support changing the scope during register operations. * Reject register operations that change the scope to a value that is already in use by another registration. * Properly un-control clients whose URL no longer matches a new active worker's scope.
Co-authored-by: Jake Archibald <[email protected]>
I think I've updated everything here finally. No need to rush to re-review, though. I'll be working on implementation for a while. |
This commit adds support for a registration
id
value. This will be used to uniquely identify registrationsinstead of
scope
. This will make it easier for a developer to migrate a registration from onescope
toanother.
The commit consists of the following changes:
id
and associated getter to the registration.origin
to the internal registration type.scope
internal representation toServiceWorker
and add a new getter.ServiceWorkerRegistration.scope
return the oldest associated worker'sscope
.(origin,id)
.(origin,id)
.Preview | Diff
Preview | Diff