Skip to content

Commit ec614c8

Browse files
committed
work in progress
1 parent 8aafaac commit ec614c8

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

docs/.index.bs.swp

320 KB
Binary file not shown.

docs/index.bs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
120120
}
121121
</pre>
122122

123+
<!-- TODO: use an origin/id tuple for registration map -->
123124
<!-- TODO: remove service worker registration/scope url completely -->
125+
<!-- TODO: set the origin on the registration properly -->
126+
<!-- TODO: valid that ServiceWorker scopes match the registration origin -->
124127

125128
<section>
126129
<h2 id="motivations">Motivations</h2>
@@ -214,6 +217,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
214217

215218
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.
216219

220+
A [=/service worker registration=] has an associated <dfn export id="dfn-origin">origin</dfn>
221+
217222
A [=/service worker registration=] has an associated <dfn export id="dfn-id">id</dfn>.
218223

219224
A [=/service worker registration=] has an associated <dfn export id="dfn-scope-url">scope url</dfn> (a [=/URL=]).
@@ -238,12 +243,12 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
238243

239244
A [=/service worker registration=] has an associated <dfn export>navigation preload header value</dfn>, which is a [=byte sequence=]. It is initially set to \`<code>true</code>\`.
240245

241-
A [=/service worker registration=] is said to be <dfn export id="dfn-service-worker-registration-unregistered">unregistered</dfn> if [=id to registration map=][this [=/service worker registration=]'s [=service worker registration/id=]] is not this [=/service worker registration=].
246+
A [=/service worker registration=] is said to be <dfn export id="dfn-service-worker-registration-unregistered">unregistered</dfn> if [=id to registration map=][(|origin|,|id|)] is not this [=/service worker registration=], where |origin| and |id| are this [=service worker registration=]'s [=service worker registration/origin=] and [=service worker registration/id=] respectively.
242247

243248
<section>
244249
<h4 id="service-worker-registration-lifetime">Lifetime</h4>
245250

246-
A user agent *must* persistently keep a list of <a>registered</a> [=/service worker registrations=] unless otherwise they are explicitly <a>unregistered</a>. A user agent has an <a>id to registration map</a> that stores the entries of the tuple of [=/service worker registration=]'s [=service worker registration/id=] and the corresponding [=/service worker registration=]. The lifetime of [=/service worker registrations=] is beyond that of the {{ServiceWorkerRegistration}} objects which represent them within the lifetime of their corresponding [=/service worker clients=].
251+
A user agent *must* persistently keep a list of <a>registered</a> [=/service worker registrations=] unless otherwise they are explicitly <a>unregistered</a>. A user agent has an <a>id to registration map</a> that stores the entries of the tuple of [=/service worker registration=]'s ([=service worker registration/origin=],[=service worker registration/id=]) and the corresponding [=/service worker registration=]. The lifetime of [=/service worker registrations=] is beyond that of the {{ServiceWorkerRegistration}} objects which represent them within the lifetime of their corresponding [=/service worker clients=].
247252
</section>
248253
</section>
249254

@@ -779,9 +784,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
779784
1. Let |promise| be [=a new promise=].
780785
1. Run the following steps [=in parallel=]:
781786
1. Let |registrations| be a new [=list=].
782-
1. [=map/For each=] |id| → |registration| of [=id to registration map=]:
787+
1. [=map/For each=] |key| → |registration| of [=id to registration map=]:
783788
1. Let |scope| be |registration|'s [=service worker registration/scope url=], [=URL serializer|serialized=].
784-
1. If the [=url/origin=] of the result of [=URL parser|parsing=] |scope| is the [=same origin|same=] as |client|'s [=environment settings object/origin=], then [=append=] |registration| to |registrations|.
789+
1. If |registration|'s [=service worker registration/origin=] is the [=same origin|same=] as |client|'s [=environment settings object/origin=], then [=append=] |registration| to |registrations|.
785790
1. [=Queue a task=] on |promise|'s [=relevant settings object=]'s [=responsible event loop=], using the [=DOM manipulation task source=], to run the following steps:
786791
1. Let |registrationObjects| be a new [=list=].
787792
1. [=list/For each=] |registration| of |registrations|:
@@ -2340,7 +2345,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
23402345

23412346
The following definitions are the user agent's internal data structures used throughout the specification.
23422347

2343-
An <dfn id="dfn-id-to-registration-map">id to registration map</dfn> is an <a>ordered map</a> where the keys are [=service worker registration/ids=] and the values are [=/service worker registrations=].
2348+
An <dfn id="dfn-id-to-registration-map">id to registration map</dfn> is an <a>ordered map</a> where the keys are ([=environment settings object/origin=],[=service worker registration/id=]) and the values are [=/service worker registrations=].
23442349

23452350
A <dfn id="dfn-job">job</dfn> is an abstraction of one of register, update, and unregister request for a [=/service worker registration=].
23462351

@@ -2634,7 +2639,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
26342639
1. Set |embedder policy| to the result of [=obtain an embedder policy|obtaining an embedder policy=] from |response|.
26352640
1. If |serviceWorkerAllowed| is failure, then:
26362641
1. Asynchronously complete these steps with a <a>network error</a>.
2637-
1. Let |id| be |registration|'s [=service worker registration/id=]
2642+
1. Let |origin| be |registration|'s [=service worker registration/origin=].
2643+
1. Let |id| be |registration|'s [=service worker registration/id=].
26382644
1. If |newest worker| is not null, then:
26392645
1. Let |scopeURL| be |newest worker|'s [=service worker/scope url=].
26402646
1. Else:
@@ -2691,7 +2697,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
26912697

26922698
Note: This will do nothing if [=Reject Job Promise=] was previously invoked with "{{SecurityError}}" {{DOMException}}.
26932699

2694-
1. If |newestWorker| is null, then [=map/remove=] [=id to registration map=][|id|].
2700+
1. If |newestWorker| is null, then [=map/remove=] [=id to registration map=][(|origin|,|id|)].
26952701
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
26962702

26972703
Else, continue the rest of these steps after the algorithm's asynchronous completion, with |script| being the asynchronous completion value.
@@ -2710,7 +2716,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
27102716
1. Let |runResult| be the result of running the [=Run Service Worker=] algorithm with |worker| and |forceBypassCache|.
27112717
1. If |runResult| is *failure* or an [=abrupt completion=], then:
27122718
1. Invoke [=Reject Job Promise=] with |job| and `TypeError`.
2713-
1. If |newestWorker| is null, then [=map/remove=] [=id to registration map=][|registration|'s [=service worker registration/id=]].
2719+
1. If |newestWorker| is null, then [=map/remove=] [=id to registration map=][(|origin|,|id|)].
27142720
1. Invoke [=Finish Job=] with |job|.
27152721
1. Else, invoke [=Install=] algorithm with |job|, |worker|, and |registration| as its arguments.
27162722
</section>

0 commit comments

Comments
 (0)