- From: Matt Falkenhagen <notifications@github.com>
- Date: Mon, 01 Jul 2019 20:27:05 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1445/review/256649257@github.com>
mattto commented on this pull request. > @@ -477,7 +477,27 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe }; </pre> - A {{ServiceWorkerRegistration}} object represents a [=/service worker registration=]. Each {{ServiceWorkerRegistration}} object is associated with a <dfn for="ServiceWorkerRegistration">service worker registration</dfn> (a [=/service worker registration=]). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same [=/service worker registration=] simultaneously. + <section> + <h4 id="service-worker-registration-creation">Getting {{ServiceWorkerRegistration}} instances</h4> + + An [=environment settings object=] has a <dfn for="environment settings object">service worker registration object map</dfn>, a [=/map=] where the [=map/keys=] are [=/service worker registrations=] and the [=map/values=] are {{ServiceWorkerRegistration}} objects. + + <section algorithm="service-worker-registration-creation-algorithm"> + To <dfn lt="get the service worker registration object|getting the service worker registration object">get the service worker registration object</dfn> representing |registration| (a [=/service worker registration=]) in |environment| (an [=environment settings object=]), run these steps: + + 1. Let |objectMap| be |environment|'s [=environment settings object/service worker registration object map=]. + 1. If |objectMap|[|registration|] does not [=map/exist=], then: + 1. Let |registrationObject| be a new {{ServiceWorkerRegistration}} in |environment|'s [=environment settings object/Realm=]. + 1. Set |registrationObject|'s [=ServiceWorkerRegistration/service worker registration=] to |registration|. + 1. Set |registrationObject|'s {{ServiceWorkerRegistration/installing}} attribute to null if |registration|'s [=service worker registration/installing worker=] is null, otherwise the result of [=getting the service worker object=] that represents |registration|'s [=service worker registration/installing worker=] in |environment|. Thanks, splitting it up is good too. I was just remembering https://github.com/whatwg/html/pull/3891#discussion_r215543183. I think just adding "and" before "otherwise" would work as well too: "if Y, and otherwise Z". -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/pull/1445#discussion_r299290353
Received on Tuesday, 2 July 2019 03:27:27 UTC