Skip to content

Commit a279060

Browse files
committed
Improve clients.claim()
Embrace the recently added environment concept in enumerating service worker clients. Related commit: 8b483b0
1 parent 3893c35 commit a279060

File tree

4 files changed

+120
-78
lines changed

4 files changed

+120
-78
lines changed

docs/index.bs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,14 +1447,24 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
14471447
<li>Run the following substeps <a>in parallel</a>:
14481448
<ol>
14491449
<li>For each <a href="#dfn-service-worker-client">service worker client</a> <var>client</var> whose <a for="resource">origin</a> is the <a lt="same origin">same</a> as the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a for="resource">origin</a>:
1450+
<p class="issue">For environment type clients, the environment's creation URL's origin should be used for the origin check instead of the client's origin. See <a href="https://github.com/whatwg/html/issues/1992">the issue</a> to define the environment's origin algorithm.</p>
14501451
<ol>
1451-
<li>If <var>client</var> is not a <a>secure context</a>, continue to the next iteration of the loop.</li>
1452+
<li>If <var>client</var> is a type of <a>environment</a>, then:
1453+
<ol>
1454+
<li>If <var>client</var>’s <a>creation URL</a> is not a <a>potentially trustworthy URL</a>, continue to the next iteration of the loop.</li>
1455+
</ol>
1456+
</li>
1457+
<li>Else:
1458+
<ol>
1459+
<li>If <var>client</var> is not a <a>secure context</a>, continue to the next iteration of the loop.</li>
1460+
</ol>
1461+
</li>
14521462
<li>Let <var>registration</var> be the result of running <a href="#scope-match-algorithm">Match Service Worker Registration</a> algorithm passing <var>client</var>'s <a>creation URL</a> as the argument.</li>
14531463
<li>If <var>registration</var> is not the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>, continue to the next iteration of the loop.</li>
1454-
<li>If <var>client</var>'s <a href="#dfn-active-worker">active worker</a> is not the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>, then:
1464+
<li>If <var>client</var>'s <a>active service worker</a> is not the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>, then:
14551465
<ol>
14561466
<li>Invoke <a href="#on-client-unload-algorithm">Handle Service Worker Client Unload</a> with <var>client</var> as the argument.</li>
1457-
<li>Set <var>client</var>'s <a href="#dfn-active-worker">active worker</a> to <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>.</li>
1467+
<li>Set <var>client</var>'s <a>active service worker</a> to <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>.</li>
14581468
<li>Invoke <a href="#notify-controller-change-algorithm">Notify Controller Change</a> algorithm with <var>client</var> as the argument.</li>
14591469
</ol>
14601470
</li>

0 commit comments

Comments
 (0)