You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An [=environment settings object=] has a <dfn for="environment settings object">service worker object map</dfn>, a [=/map=] where the [=map/keys=] are [=/service workers=] and the [=map/values=] are {{ServiceWorker}} objects.
To <dfn lt="get the service worker object|getting the service worker object">get the service worker object</dfn> representing |serviceWorker| (a [=/service worker=]) in |environment| (an [=environment settings object=]), run these steps:
347
+
348
+
1. Let |objectMap| be |environment|'s [=environment settings object/service worker object map=].
349
+
1. If |objectMap|[|serviceWorker|] does not [=map/exist=], then set |objectMap|[|serviceWorker|] to a new {{ServiceWorker}} in |environment|'s [=environment settings object/Realm=], and associate it with |serviceWorker|.
1. Let |serviceWorker| be the [=/service worker=] represented by the <a>context object</a>.
379
393
1. If the result of running the [=Should Skip Event=] algorithm with "message" and |serviceWorker|, is true, then return.
380
394
1. Invoke <a>Run Service Worker</a> algorithm with |serviceWorker| as the argument.
381
-
1. Let |incumbentSettings| be the <a>incumbent settings object</a>, and |incumbentGlobal| its [=environment settings object/global object=].
395
+
1. Let |incumbentSettings| be the [=incumbent settings object=].
396
+
1. Let |incumbentGlobal| be |incumbentSettings|'s [=environment settings object/global object=].
382
397
1. Let |serializeWithTransferResult| be <a abstract-op>StructuredSerializeWithTransfer</a>(|message|, |options|.transfer). Rethrow any exceptions.
383
398
1. [=Queue a task=] on the [=DOM manipulation task source=] to run the following steps:
384
399
1. Let |source| be determined by switching on the type of |incumbentGlobal|:
385
400
<dl class="switch">
386
401
<dt>{{ServiceWorkerGlobalScope}}</dt>
387
-
<dd>a new {{ServiceWorker}}object that represents |incumbentGlobal|'s [=ServiceWorkerGlobalScope/service worker=].</dd>
402
+
<dd>The result of [=getting the service worker object=] that represents |incumbentGlobal|'s [=ServiceWorkerGlobalScope/service worker=] in the [=relevant settings object=] of |serviceWorker|'s [=service worker/global object=].</dd>
388
403
389
404
<dt>{{Window}}</dt>
390
405
<dd>a new {{WindowClient}} object that represents |incumbentGlobal|'s [=relevant settings object=].</dd>
<dfn attribute for="ServiceWorkerContainer"><code>controller</code></dfn> attribute *must* run these steps:
617
632
618
633
1. Let |client| be the <a>context object</a>'s [=ServiceWorkerContainer/service worker client=].
619
-
1. Return the {{ServiceWorker}} object that represents |client|'s <a>active service worker</a>.
634
+
1. If |client|'s [=active service worker=] is null, then return null.
635
+
1. Return the result of [=getting the service worker object=] that represents |client|'s [=active service worker=] in the [=context object=]'s [=relevant settings object=].
620
636
621
-
Note: {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} returns <code>null</code> if the request is a force refresh (shift+refresh). The {{ServiceWorker}} objects returned from this attribute getter that represent the same [=/service worker=] are the same objects.
637
+
Note: {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} returns <code>null</code> if the request is a force refresh (shift+refresh).
<dfn attribute for="ServiceWorkerGlobalScope"><code>clients</code></dfn> attribute *must* return the {{Clients}} object that is associated with the <a>context object</a>.
941
+
The <dfn attribute for="ServiceWorkerGlobalScope"><code>clients</code></dfn> attribute *must* return the {{Clients}} object that is associated with the <a>context object</a>.
The <dfn method for="Client"><code>postMessage(|message|, |options|)</code></dfn> method *must* run these steps:
1076
1091
1077
-
1. Let |sourceSettings| be the [=context object=]'s [=relevant settings object=].
1092
+
1. Let |contextObject| be the [=context object=].
1093
+
1. Let |sourceSettings| be the |contextObject|'s [=relevant settings object=].
1078
1094
1. Let |serializeWithTransferResult| be <a abstract-op>StructuredSerializeWithTransfer</a>(|message|, |options|.transfer). Rethrow any exceptions.
1079
1095
1. Run the following steps [=in parallel=]:
1080
1096
1. Let |targetClient| be null.
1081
1097
1. For each [=/service worker client=] |client|:
1082
-
1. If |client| is the [=context object=]'s [=Client/service worker client=], set |targetClient| to |client|, and [=break=].
1098
+
1. If |client| is the |contextObject|'s [=Client/service worker client=], set |targetClient| to |client|, and [=break=].
1083
1099
1. If |targetClient| is null, return.
1084
1100
1. Let |destination| be the {{ServiceWorkerContainer}} object whose associated [=ServiceWorkerContainer/service worker client=] is |targetClient|.
1085
1101
1. Add a [=task=] that runs the following steps to |destination|'s [=ServiceWorkerContainer/client message queue=]:
1086
1102
1. Let |origin| be the [=Unicode serialization of an origin|Unicode serialization=] of |sourceSettings|'s [=environment settings object/origin=].
1087
-
1. Let |source| be a {{ServiceWorker}} object, which represents the [=ServiceWorkerGlobalScope/service worker=]associated with |sourceSettings|'s [=environment settings object/global object=].
1103
+
1. Let |source| be the result of [=getting the service worker object=]that represents |contextObject|'s [=relevant global object=]'s [=ServiceWorkerGlobalScope/service worker=] in |targetClient|.
1088
1104
1. Let |deserializeRecord| be <a abstract-op>StructuredDeserializeWithTransfer</a>(|serializeWithTransferResult|, |destination|'s [=relevant Realm=]).
1089
1105
1090
1106
If this throws an exception, catch it, [=fire an event=] named {{messageerror!!event}} at |destination|, using {{MessageEvent}}, with the {{MessageEvent/origin}} attribute initialized to |origin| and the {{MessageEvent/source}} attribute initialized to |source|, and then abort these steps.
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
2615
2631
1. Let |settingsObjects| be all [=environment settings objects=] whose [=environment settings object/origin=] is |registration|'s [=service worker registration/scope url=]'s origin.
2616
2632
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:
2617
-
1. Let |registrationObjects| be every {{ServiceWorkerRegistration}} object in |settingsObject|'s [=environment settings object/realm execution context=], whose [=ServiceWorkerRegistration/service worker registration=] is |registration|.
2633
+
1. Let |registrationObjects| be every {{ServiceWorkerRegistration}} object in |settingsObject|'s [=environment settings object/realm=], whose [=ServiceWorkerRegistration/service worker registration=] is |registration|.
2618
2634
1. For each |registrationObject| of |registrationObjects|, [=fire an event=] on |registrationObject| named `updatefound`.
2619
2635
1. Let |installingWorker| be |registration|'s <a>installing worker</a>.
2620
2636
1. If the result of running the [=Should Skip Event=] algorithm with |installingWorker| and "install" is false, then:
:: |registration|, a [=/service worker registration=]
3091
-
:: |target|, a string (one of "<code>installing</code>", "<code>waiting</code>", and "<code>active</code>")
3107
+
:: |target|, a string (one of "`installing`", "`waiting`", and "`active`")
3092
3108
:: |source|, a [=/service worker=] or null
3093
3109
: Output
3094
3110
:: None
3095
3111
3096
3112
1. Let |registrationObjects| be an array containing all the {{ServiceWorkerRegistration}} objects associated with |registration|.
3097
-
1. If |target| is "<code>installing</code>", then:
3098
-
1. Set |registration|'s <a>installing worker</a> to |source|.
3113
+
1. If |target| is "`installing`", then:
3114
+
1. Set |registration|'s [=installing worker=] to |source|.
3099
3115
1. For each |registrationObject| in |registrationObjects|:
3100
-
1. <a>Queue a task</a> to set the {{ServiceWorkerRegistration/installing}} attribute of |registrationObject| to the {{ServiceWorker}} object that represents |registration|’s <a>installing worker</a>, or null if |registration|’s <a>installing worker</a> is null.
3101
-
1. Else if |target| is "<code>waiting</code>", then:
3102
-
1. Set |registration|'s <a>waiting worker</a> to |source|.
3116
+
1. [=Queue a task=] to set the {{ServiceWorkerRegistration/installing}} attribute of |registrationObject| to null if |registration|’s [=installing worker=] is null, or the result of [=getting the service worker object=] that represents |registration|’s [=installing worker=] in |registrationObject|'s [=relevant settings object=].
3117
+
1. Else if |target| is "`waiting`", then:
3118
+
1. Set |registration|'s [=waiting worker=] to |source|.
3103
3119
1. For each |registrationObject| in |registrationObjects|:
3104
-
1. <a>Queue a task</a> to set the {{ServiceWorkerRegistration/waiting}} attribute of |registrationObject| to the {{ServiceWorker}} object that represents |registration|’s <a>waiting worker</a>, or null if |registration|’s <a>waiting worker</a> is null.
3105
-
1. Else if |target| is "<code>active</code>", then:
3120
+
1. [=Queue a task=] to set the {{ServiceWorkerRegistration/waiting}} attribute of |registrationObject| to null if |registration|’s [=waiting worker=] is null, or the result of [=getting the service worker object=] that represents |registration|’s [=waiting worker=] in |registrationObject|'s [=relevant settings object=].
3121
+
1. Else if |target| is "`active`", then:
3106
3122
1. Set |registration|'s [=service worker registration/active worker=] to |source|.
3107
3123
1. For each |registrationObject| in |registrationObjects|:
3108
-
1. <a>Queue a task</a> to set the {{ServiceWorkerRegistration/active}} attribute of |registrationObject| to the {{ServiceWorker}} object that represents |registration|’s [=service worker registration/active worker=], or null if |registration|’s[=service worker registration/active worker=]is null.
3124
+
1. [=Queue a task=] to set the {{ServiceWorkerRegistration/active}} attribute of |registrationObject| to null if |registration|’s [=active worker=] is null, or the result of[=getting the service worker object=] that represents |registration|’s [=active worker=]in |registrationObject|'s [=relevant settings object=].
3109
3125
3110
-
The <a>task</a> *must* use |registrationObject|'s <a>relevant settings object</a>'s <a>responsible event loop</a> and the <a>DOM manipulation task source</a>.
3126
+
The [=task=] *must* use |registrationObject|'s [=relevant settings object=]'s [=responsible event loop=] and the [=DOM manipulation task source=].
0 commit comments