Skip to content

Commit 5580c1d

Browse files
Adding self.serviceWorker to service workers. (#1426)
* Adding self.serviceWorker to service workers. * Exposing parsed state
1 parent a47c6d8 commit 5580c1d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/index.bs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
329329
ServiceWorker includes AbstractWorker;
330330

331331
enum ServiceWorkerState {
332+
"parsed",
332333
"installing",
333334
"installed",
334335
"activating",
@@ -926,6 +927,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
926927
interface ServiceWorkerGlobalScope : WorkerGlobalScope {
927928
[SameObject] readonly attribute Clients clients;
928929
[SameObject] readonly attribute ServiceWorkerRegistration registration;
930+
[SameObject] readonly attribute ServiceWorker serviceWorker;
929931

930932
[NewObject] Promise<void> skipWaiting();
931933

@@ -954,6 +956,12 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
954956
The <dfn attribute for="ServiceWorkerGlobalScope"><code>registration</code></dfn> attribute *must* return the {{ServiceWorkerRegistration}} object that represents the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>.
955957
</section>
956958

959+
<section>
960+
<h4 id="service-worker-global-scope-serviceworker">{{ServiceWorkerGlobalScope/serviceWorker}}</h4>
961+
962+
The <dfn attribute for="ServiceWorkerGlobalScope"><code>serviceWorker</code></dfn> attribute *must* return the result of [=getting the service worker object=] that represents the [=context object=]'s [=ServiceWorkerGlobalScope/service worker=] in the [=context object=]'s [=relevant settings object=].
963+
</section>
964+
957965
<section algorithm="service-worker-global-scope-skipwaiting">
958966
<h4 id="service-worker-global-scope-skipwaiting">{{ServiceWorkerGlobalScope/skipWaiting()}}</h4>
959967

@@ -3158,6 +3166,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
31583166
: Output
31593167
:: None
31603168

3169+
1. Assert: |state| is not "`parsed`".
3170+
3171+
Note: "`parsed`" is the initial state. A [=/service worker=] is never updated to this state.
3172+
31613173
1. Set |worker|'s [=service worker/state=] to |state|.
31623174
1. Let |settingsObjects| be all [=environment settings objects=] whose [=environment settings object/origin=] is |worker|'s [=service worker/script url=]'s [=url/origin=].
31633175
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:

0 commit comments

Comments
 (0)