Skip to content

Commit ffab8b1

Browse files
committed
update scope during register job
1 parent 5577df5 commit ffab8b1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

docs/index.bs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
122122
}
123123
</pre>
124124

125-
<!-- TODO: change scope logic -->
126125
<!-- TODO: uncontrol old clients that no longer match in Activate -->
126+
<!-- TODO: look for conflicting scopes -->
127127

128128
<section>
129129
<h2 id="motivations">Motivations</h2>
@@ -621,7 +621,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
621621
1. If |newestWorker| is null, return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}} and abort these steps.
622622
1. If [=this=]'s [=relevant global object=] |globalObject| is a {{ServiceWorkerGlobalScope}} object, and |globalObject|'s associated [=ServiceWorkerGlobalScope/service worker=]'s <a>state</a> is "`installing`", return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}} and abort these steps.
623623
1. Let |promise| be a <a>promise</a>.
624-
1. Let |job| be the result of running <a>Create Job</a> with *update*, |registration|'s [=service worker registration/origin=], [=service worker registration/id=], |newestWorkers|'s [=service worker/scope url=], |newestWorker|'s [=service worker/script url=], |promise|, and the [=this=]'s <a>relevant settings object</a>.
624+
1. Let |job| be the result of running <a>Create Job</a> with *update*, |registration|'s [=service worker registration/origin=], [=service worker registration/id=], null, |newestWorker|'s [=service worker/script url=], |promise|, and the [=this=]'s <a>relevant settings object</a>.
625625
1. Set |job|'s <a>worker type</a> to |newestWorker|'s [=service worker/type=].
626626
1. Invoke <a>Schedule Job</a> with |job|.
627627
1. Return |promise|.
@@ -637,7 +637,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
637637
1. Let |promise| be [=a new promise=].
638638
1. Let |newestWorker| be the result of running <a>Get Newest Worker</a> algorithm passing |registration| as its argument.
639639
1. If |newestWorker| is null, return [=a promise rejected with=] an "{{InvalidStateError}}" {{DOMException}} and abort these steps.
640-
1. Let |job| be the result of running [=Create Job=] with *unregister*, the [=service worker registration/origin=], [=service worker registration/id=] of the [=ServiceWorkerRegistration/service worker registration=], |newest worker|'s [=service worker/scope url=], null, |promise|, and the [=this=]'s <a>relevant settings object</a>.
640+
1. Let |job| be the result of running [=Create Job=] with *unregister*, the [=service worker registration/origin=], [=service worker registration/id=] of the [=ServiceWorkerRegistration/service worker registration=], null, null, |promise|, and the [=this=]'s <a>relevant settings object</a>.
641641
1. Invoke <a>Schedule Job</a> with |job|.
642642
1. Return |promise|.
643643
</section>
@@ -2613,11 +2613,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
26132613
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=job/origin=] and [=job/id=] as the arguments.
26142614
1. If |registration| is not null, then:
26152615
1. Let |newestWorker| be the result of running the <a>Get Newest Worker</a> algorithm passing |registration| as the argument.
2616-
1. If |newestWorker| is not null, |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=], |job|'s [=job/worker type=] equals |newestWorker|'s [=service worker/type=], and |job|'s [=job/update via cache mode=]'s value equals |registration|'s [=service worker registration/update via cache mode=], then:
2616+
1. If |newestWorker| is not null, |job|'s [=job/scope url=] [=url/equals=] |newestWorker|'s [=service worker/scope url=], |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=], |job|'s [=job/worker type=] equals |newestWorker|'s [=service worker/type=], and |job|'s [=job/update via cache mode=]'s value equals |registration|'s [=service worker registration/update via cache mode=], then:
26172617
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
26182618
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
26192619
1. Else:
2620-
1. Invoke <a>Set Registration</a> algorithm with |job|'s [=job/origin=], |job|'s [=job/id], and |job|'s [=job/update via cache mode=].
2620+
1. Invoke <a>Set Registration</a> algorithm with |job|'s [=job/origin=], |job|'s [=job/id=], and |job|'s [=job/update via cache mode=].
26212621
1. Invoke <a>Update</a> algorithm passing |job| as the argument.
26222622
</section>
26232623

@@ -2682,9 +2682,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
26822682
1. Asynchronously complete these steps with a <a>network error</a>.
26832683
1. Let |origin| be |registration|'s [=service worker registration/origin=].
26842684
1. Let |id| be |registration|'s [=service worker registration/id=].
2685-
1. If |newest worker| is not null, then:
2685+
1. If |job|'s [=job/scope url=] is null, then:
2686+
1. Assert: |job|'s [=job/job type=] is *update*.
26862687
1. Let |scopeURL| be |newest worker|'s [=service worker/scope url=].
26872688
1. Else:
2689+
1. Assert: |job|'s [=job/job type=] is *register*.
26882690
1. Let |scopeURL| be |job|'s [=job/scope url=].
26892691
1. Let |maxScopeString| be null.
26902692
1. If |serviceWorkerAllowed| is null, then:
@@ -2747,7 +2749,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
27472749
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
27482750
1. Invoke [=Finish Job=] with |job| and abort these steps.
27492751
1. Let |worker| be a new [=/service worker=].
2750-
1. Set |worker|'s [=service worker/script url=] to |job|'s [=job/script url=], |worker|'s [=script resource=] to |script|, |worker|'s [=service worker/type=] to |job|'s [=worker type=], and |worker|'s [=script resource map=] to |updatedResourceMap|.
2752+
1. Set |worker|'s [=service worker/script url=] to |job|'s [=job/script url=], |worker|'s [=service worker/scope url=] to |job|'s [=job/scope url=], |worker|'s [=script resource=] to |script|, |worker|'s [=service worker/type=] to |job|'s [=worker type=], and |worker|'s [=script resource map=] to |updatedResourceMap|.
27512753
1. Append |url| to |worker|'s [=set of used scripts=].
27522754
1. Set |worker|'s <a>script resource</a>'s [=script resource/referrer policy=] to |referrerPolicy|.
27532755
1. Assert: |embedder policy| is not null.

0 commit comments

Comments
 (0)