Add ServiceWorkerRegistration.id and supporting algorithm changes. (Fixes #1512)#1526
Add ServiceWorkerRegistration.id and supporting algorithm changes. (Fixes #1512)#1526wanderview wants to merge 9 commits intow3c:mainfrom
ServiceWorkerRegistration.id and supporting algorithm changes. (Fixes #1512)#1526Conversation
|
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)
jakearchibald
left a comment
There was a problem hiding this comment.
Mostly prose nits. The only real concern is the backwards compatibility break with reg.scope.
| <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.
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.
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.
I guess we have this a few places in the spec, but I don't actually know what it means.
| 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>. |
|
Thanks for the review @jakearchibald! I will work on addressing this next week after I clear some other things off my TODO list. |
| </pre> | ||
| <pre class="idl" id="registration-option-list-dictionary"> | ||
| dictionary RegistrationOptions { | ||
| DOMString id; |
There was a problem hiding this comment.
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 <jaffathecake@gmail.com>
|
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
idvalue. This will be used to uniquely identify registrationsinstead of
scope. This will make it easier for a developer to migrate a registration from onescopetoanother.
The commit consists of the following changes:
idand associated getter to the registration.originto the internal registration type.scopeinternal representation toServiceWorkerand add a new getter.ServiceWorkerRegistration.scopereturn the oldest associated worker'sscope.(origin,id).(origin,id).Preview | Diff
Preview | Diff