Skip to content

Commit b622281

Browse files
committed
Kill resurrection (fixes #1204)
1 parent c3f8eca commit b622281

File tree

2 files changed

+59
-60
lines changed

2 files changed

+59
-60
lines changed

Diff for: docs/index.bs

+19-19
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
210210

211211
A [=/service worker registration=] has an associated <dfn export id="dfn-update-via-cache">update via cache mode</dfn>, which is "`imports`", "`all`", or "`none`". It is initially set to "`imports`".
212212

213-
A [=/service worker registration=] has an associated <dfn export id="dfn-uninstalling-flag">uninstalling flag</dfn>. It is initially unset.
214-
215213
A [=/service worker registration=] has one or more <dfn export id="dfn-service-worker-registration-task-queue">task queues</dfn> that back up the <a>tasks</a> from its <a>active worker</a>'s <a>event loop</a>'s corresponding [=/task queues=]. (The target task sources for this back up operation are the <a>handle fetch task source</a> and the <a>handle functional event task source</a>.) The user agent dumps the <a>active worker</a>'s <a>tasks</a> to the [=/service worker registration=]'s [=service worker registration/task queues=] when the <a>active worker</a> is <a lt="terminate service worker">terminated</a> and <a lt="queue a task">re-queues those tasks</a> to the <a>active worker</a>'s <a>event loop</a>'s corresponding [=/task queues=] when the <a>active worker</a> spins off. Unlike the [=/task queues=] owned by <a>event loops</a>, the [=/service worker registration=]'s [=service worker registration/task queues=] are not processed by any <a>event loops</a> in and of itself.
216214

217215
A [=/service worker registration=] has an associated <dfn export>{{NavigationPreloadManager}}</dfn> object.
@@ -220,6 +218,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
220218

221219
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>\`.
222220

221+
A [=/service worker registration=] is said to be <dfn export id="dfn-service-worker-registration-uninstalled">unregistered</dfn> if [=scope to registration map=][[=service worker registration/scope url=]] is not this [=/service worker registration=].
222+
223223
<section>
224224
<h4 id="service-worker-registration-lifetime">Lifetime</h4>
225225

@@ -678,7 +678,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
678678
1. Run the following steps [=in parallel=]:
679679
1. Let |registrations| be a new [=list=].
680680
1. [=map/For each=] |scope| → |registration| of [=scope to registration map=]:
681-
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=], and |registration|'s [=uninstalling flag=] is unset, then [=append=] |registration| to |registrations|.
681+
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|.
682682
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:
683683
1. Let |registrationObjects| be a new [=list=].
684684
1. [=list/For each=] |registration| of |registrations|, [=append=] the {{ServiceWorkerRegistration}} object associated with |registration| to |registrationObjects|.
@@ -1297,6 +1297,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
12971297
1. If |client| is not a [=secure context=], [=continue=].
12981298
1. Let |registration| be the result of running <a>Match Service Worker Registration</a> algorithm passing |client|'s <a>creation URL</a> as the argument.
12991299
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, [=continue=].
1300+
1301+
Note: |registration| will be null if the [=ServiceWorkerGlobalScope/service worker=]'s [=containing service worker registration=] is [=service worker registration/unregistered=].
1302+
13001303
1. If |client|'s <a>active service worker</a> is not the [=ServiceWorkerGlobalScope/service worker=], then:
13011304
1. Invoke <a>Handle Service Worker Client Unload</a> with |client| as the argument.
13021305
1. Set |client|'s <a>active service worker</a> to [=ServiceWorkerGlobalScope/service worker=].
@@ -1360,8 +1363,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
13601363
1. Upon [=upon fulfillment|fulfillment=] or [=upon rejection|rejection=] of |promise|, [=queue a microtask=] to run these substeps:
13611364
1. Decrement |event|'s [=ExtendableEvent/pending promises count=] by one.
13621365
1. If |event|'s [=ExtendableEvent/pending promises count=] is 0, then:
1363-
1. Let |registration| be the [=context object=]'s [=relevant global object=]'s associated [=ServiceWorkerGlobalScope/service worker=]'s [=containing service worker registration=].
1364-
1. If |registration|'s [=uninstalling flag=] is set, invoke [=Try Clear Registration=] with |registration|.
1366+
1. Let |registration| be the [=current global object=]'s associated [=ServiceWorkerGlobalScope/service worker=]'s [=containing service worker registration=].
1367+
1. If |registration| is [=service worker registration/unregistered=], invoke [=Try Clear Registration=] with |registration|.
13651368
1. If |registration| is not null, invoke [=Try Activate=] with |registration|.
13661369

13671370
The user agent *should not* [=terminate service worker|terminate=] a [=/service worker=] if [=Service Worker Has No Pending Events=] returns false for that [=/service worker=].
@@ -2434,7 +2437,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
24342437
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
24352438
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=job/scope url=] as the argument.
24362439
1. If |registration| is not null, then:
2437-
1. If |registration|'s <a>uninstalling flag</a> is set, unset it.
24382440
1. Let |newestWorker| be the result of running the <a>Get Newest Worker</a> algorithm passing |registration| as the argument.
24392441
1. If |newestWorker| is not null, |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=], and |job|'s [=job/update via cache mode=]'s value equals |registration|'s [=service worker registration/update via cache mode=], then:
24402442
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
@@ -2453,7 +2455,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
24532455
:: none
24542456

24552457
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=job/scope url=] as the argument.
2456-
1. If |registration| is null or |registration|'s <a>uninstalling flag</a> is set, then:
2458+
1. If |registration| is null or |registration| is [=service worker registration/unregistered=], then:
24572459
1. Invoke [=Reject Job Promise=] with |job| and `TypeError`.
24582460
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
24592461
1. Let |newestWorker| be the result of running <a>Get Newest Worker</a> algorithm passing |registration| as the argument.
@@ -2604,7 +2606,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
26042606
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>installing worker</a> and *installing* as the arguments.
26052607
1. Assert: |job|'s [=job/job promise=] is not null.
26062608
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
2607-
1. <a>Queue a task</a> to <a>fire an event</a> named <code>updatefound</code> at all the {{ServiceWorkerRegistration}} objects for all the [=/service worker clients=] whose <a>creation URL</a> <a lt="Match Service Worker Registration">matches</a> |registration|'s [=service worker registration/scope url=] and all the [=/service workers=] whose <a>containing service worker registration</a> is |registration|.
2609+
1. Let |settingsObjects| be all [=environment settings objects=] whose [=environment settings object/origin=] is |registration|'s [=service worker registration/scope url=]'s origin.
2610+
1. For each |settingsObject| of |settingsObjects|, [=queue a task=] on |settingsObject| to run the following steps:
2611+
1. Let |registrationObjects| be every {{ServiceWorkerRegistration}} object in |settingsObject|'s [=environment settings object/realm execution context=], whose [=ServiceWorkerRegistration/service worker registration=] is |registration|.
2612+
1. For each |registrationObject| of |registrationObjects|, [=fire an event=] on |registrationObject| named `updatefound`.
26082613
1. Let |installingWorker| be |registration|'s <a>installing worker</a>.
26092614
1. Invoke <a>Run Service Worker</a> algorithm given |installingWorker|, and with the *force bypass cache for importscripts flag* set if |job|'s [=job/force bypass cache flag=] is set.
26102615
1. <a>Queue a task</a> |task| to run the following substeps:
@@ -2900,7 +2905,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
29002905
: Output
29012906
:: None
29022907

2903-
1. Assert: [=scope to registration map=] contains a value equal to |registration|.
29042908
1. Assert: |registration|'s [=active worker=] is not null.
29052909
1. Let |activeWorker| be |registration|'s [=active worker=].
29062910
1. If |activeWorker|'s [=set of event types to handle=] does not [=set/contain=] |eventName|, then return and run the following steps [=in parallel=]:
@@ -2956,8 +2960,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
29562960
1. Let |registration| be the [=/service worker registration=] <a>used</a> by |client|.
29572961
1. If |registration| is null, abort these steps.
29582962
1. If any other [=/service worker client=] is <a>using</a> |registration|, abort these steps.
2959-
1. If |registration|'s [=uninstalling flag=] is set, invoke [=Try Clear Registration=] with |registration|.
2960-
1. If |registration| is not null, invoke [=Try Activate=] with |registration|.
2963+
1. If |registration| is [=service worker registration/unregistered=], invoke [=Try Clear Registration=] with |registration|.
2964+
1. Invoke [=Try Activate=] with |registration|.
29612965
</section>
29622966

29632967
<section algorithm>
@@ -3006,7 +3010,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
30063010
1. If |registration| is null, then:
30073011
1. Invoke <a>Resolve Job Promise</a> with |job| and false.
30083012
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
3009-
1. Set |registration|'s <a>uninstalling flag</a>.
3013+
1. [=map/Remove=] [=scope to registration map=][|job|'s [=job/scope url=]].
30103014
1. Invoke <a>Resolve Job Promise</a> with |job| and true.
30113015
1. Invoke [=Try Clear Registration=] with |registration|.
30123016

@@ -3052,8 +3056,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
30523056
1. [=Terminate Service Worker|Terminate=] |registration|'s [=active worker=].
30533057
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=active worker=] and *redundant* as the arguments.
30543058
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>active</code>" and null as the arguments.
3055-
1. Let |scopeString| be |registration|'s [=URL serializer|serialized=] [=service worker registration/scope url=].
3056-
1. [=map/Remove=] <a>scope to registration map</a>[|scopeString|].
30573059
</section>
30583060

30593061
<section algorithm>
@@ -3176,7 +3178,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
31763178
1. Set |matchingScope| to the result of <a lt="URL parser">parsing</a> |matchingScopeString|.
31773179
1. Assert: |matchingScope|'s [=url/origin=] and |clientURL|'s [=url/origin=] are [=same origin=].
31783180
1. Let |registration| be the result of running <a>Get Registration</a> algorithm passing |matchingScope| as the argument.
3179-
1. If |registration| is not null and |registration|'s <a>uninstalling flag</a> is set, return null.
31803181
1. Return |registration|.
31813182
</section>
31823183

@@ -3186,15 +3187,14 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
31863187
: Input
31873188
:: |scope|, a [=/URL=]
31883189
: Output
3189-
:: |registration|, a [=/service worker registration=]
3190+
:: A [=/service worker registration=]
31903191

31913192
1. Run the following steps atomically.
31923193
1. Let |scopeString| be the empty string.
31933194
1. If |scope| is not null, set |scopeString| to [=URL serializer|serialized=] |scope| with the *exclude fragment flag* set.
3194-
1. Let |registration| be null.
31953195
1. [=map/For each=] |key| → |value| of <a>scope to registration map</a>:
3196-
1. If |scopeString| matches |key|, set |registration| to |value|.
3197-
1. Return |registration|.
3196+
1. If |scopeString| matches |key|, then return |value|.
3197+
1. Return null.
31983198
</section>
31993199

32003200
<section algorithm>

0 commit comments

Comments
 (0)