Skip to content
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

Update order #1436

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2659,19 +2659,18 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
1. Wait for |task| to have executed or been discarded.
1. Wait for the step labeled *WaitForAsynchronousExtensions* to complete.
1. If |installFailed| is true, then:
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. Run the [=Update Registration State=] algorithm passing |registration|, "`installing`" and null as the arguments.
1. Run the [=Update Worker State=] algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. If |newestWorker| is null, then [=map/remove=] [=scope to registration map=][|registration|'s [=service worker registration/scope url=], [[=URL serializer|serialized=]].
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
1. Let |map| be |registration|'s [=installing worker=]'s [=script resource map=].
1. Let |usedSet| be |registration|'s [=installing worker=]'s [=set of used scripts=].
1. [=map/For each=] |url| of |map|:
1. If |usedSet| does not [=list/contain=] |url|, then [=map/remove=] |map|[|url|].
1. If |registration|'s <a>waiting worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=waiting worker=].
1. Run the [=Update Worker State=] algorithm passing |registration|'s [=waiting worker=] and "`redundant`" as the arguments.
1. Let |redundantWorker| be |registration|'s [=waiting worker=].
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and |registration|'s <a>installing worker</a> as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. If |redundantWorker| is not null, then run the [=Update Worker State=] algorithm passing |redundantWorker| and "`redundant`" as the arguments.
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>waiting worker</a> and "`installed`" as the arguments.
1. Invoke <a>Finish Job</a> with |job|.
1. Wait for all the <a>tasks</a> <a lt="queue a task">queued</a> by <a>Update Worker State</a> invoked in this algorithm to have executed.
Expand All @@ -2689,11 +2688,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. If |registration|'s <a>waiting worker</a> is null, abort these steps.
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 |redundantWorker| be |registration|'s [=active worker=].
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>active</code>" and |registration|'s <a>waiting worker</a> as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and null as the arguments.
1. If |redundantWorker| is not null, then run the [=Update Worker State=] algorithm passing |redundantWorker| and "`redundant`" as the arguments.
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>active worker</a> and "`activating`" as the arguments.

Note: Once an active worker is activating, neither a runtime script error nor a force termination of the active worker prevents the active worker from getting activated.
Expand Down Expand Up @@ -3094,18 +3092,17 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. Run the following steps atomically.
1. If |registration|'s <a>installing worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=installing worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. If |registration|'s <a>waiting worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=waiting worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=waiting worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and null as the arguments.
1. If |registration|'s <a>active worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=active worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=active worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>active</code>" and null as the arguments.
1. Let |redundantWorkers| be a new [=/list=].
1. If |registration|'s [=installing worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`installing`" and null as the arguments.
1. [=list/Append=] |registration|'s [=installing worker=] to |redundantWorkers|.
1. If |registration|'s [=waiting worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`waiting`" and null as the arguments.
1. [=list/Append=] |registration|'s [=waiting worker=] to |redundantWorkers|.
1. If |registration|'s [=active worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`active`" and null as the arguments.
1. [=list/Append=] |registration|'s [=waiting worker=] to |redundantWorkers|.
1. [=list/For each=] |redundantWorker| of |redundantWorkers|, run [=Update Worker State=] with |redundantWorker| and "`redundant`".
</section>

<section algorithm>
Expand Down Expand Up @@ -3159,6 +3156,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. Set |worker|'s [=service worker/state=] to |state|.
1. If |state| is "`redundant`", then [=Terminate Service Worker|terminate=] |worker|.
1. Let |settingsObjects| be all [=environment settings objects=] whose [=environment settings object/origin=] is |worker|'s [=service worker/script url=]'s [=url/origin=].
1. For each |settingsObject| of |settingsObjects|, [=queue a task=] on |settingsObject|'s [=responsible event loop=] in the [=DOM manipulation task source=] to run the following steps:
1. Let |objectMap| be |settingsObject|'s [=environment settings object/service worker object map=].
Expand Down
38 changes: 18 additions & 20 deletions docs/v1/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2480,15 +2480,14 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
1. Wait for |task| to have executed or been discarded.
1. Wait for the step labeled *WaitForAsynchronousExtensions* to complete.
1. If |installFailed| is true, then:
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. Run the [=Update Registration State=] algorithm passing |registration|, "`installing`" and null as the arguments.
1. Run the [=Update Worker State=] algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. If |newestWorker| is null, then [=map/remove=] [=scope to registration map=][|registration|'s [=service worker registration/scope url=], [[=URL serializer|serialized=]].
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
1. If |registration|'s <a>waiting worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=waiting worker=].
1. Run the [=Update Worker State=] algorithm passing |registration|'s [=waiting worker=] and "`redundant`" as the arguments.
1. Let |redundantWorker| be |registration|'s [=waiting worker=].
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and |registration|'s <a>installing worker</a> as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. If |redundantWorker| is not null, then run the [=Update Worker State=] algorithm passing |redundantWorker| and "`redundant`" as the arguments.
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>waiting worker</a> and "`installed`" as the arguments.
1. Invoke <a>Finish Job</a> with |job|.
1. Wait for all the <a>tasks</a> <a lt="queue a task">queued</a> by <a>Update Worker State</a> invoked in this algorithm to have executed.
Expand All @@ -2506,11 +2505,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. If |registration|'s <a>waiting worker</a> is null, abort these steps.
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 |redundantWorker| be |registration|'s [=active worker=].
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>active</code>" and |registration|'s <a>waiting worker</a> as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and null as the arguments.
1. If |redundantWorker| is not null, then run the [=Update Worker State=] algorithm passing |redundantWorker| and "`redundant`" as the arguments.
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>active worker</a> and "`activating`" as the arguments.

Note: Once an active worker is activating, neither a runtime script error nor a force termination of the active worker prevents the active worker from getting activated.
Expand Down Expand Up @@ -2885,18 +2883,17 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. Run the following steps atomically.
1. If |registration|'s <a>installing worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=installing worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=installing worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
1. If |registration|'s <a>waiting worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=waiting worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=waiting worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>waiting</code>" and null as the arguments.
1. If |registration|'s <a>active worker</a> is not null, then:
1. [=Terminate Service Worker|Terminate=] |registration|'s [=active worker=].
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s [=active worker=] and "`redundant`" as the arguments.
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>active</code>" and null as the arguments.
1. Let |redundantWorkers| be a new [=/list=].
1. If |registration|'s [=installing worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`installing`" and null as the arguments.
1. [=list/Append=] |registration|'s [=installing worker=] to |redundantWorkers|.
1. If |registration|'s [=waiting worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`waiting`" and null as the arguments.
1. [=list/Append=] |registration|'s [=waiting worker=] to |redundantWorkers|.
1. If |registration|'s [=active worker=] is not null, then:
1. Run the [=Update Registration State=] algorithm passing |registration|, "`active`" and null as the arguments.
1. [=list/Append=] |registration|'s [=waiting worker=] to |redundantWorkers|.
1. [=list/For each=] |redundantWorker| of |redundantWorkers|, run [=Update Worker State=] with |redundantWorker| and "`redundant`".
</section>

<section algorithm>
Expand Down Expand Up @@ -2950,6 +2947,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
:: None

1. Set |worker|'s [=service worker/state=] to |state|.
1. If |state| is "`redundant`", then [=Terminate Service Worker|terminate=] |worker|.
1. Let |settingsObjects| be all [=environment settings objects=] whose [=environment settings object/origin=] is |worker|'s [=service worker/script url=]'s [=url/origin=].
1. For each |settingsObject| of |settingsObjects|, [=queue a task=] on |settingsObject|'s [=responsible event loop=] in the [=DOM manipulation task source=] to run the following steps:
1. Let |objectMap| be |settingsObject|'s [=environment settings object/service worker object map=].
Expand Down