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
- Embrace the recently added environment concept in enumerating
service worker clients.
- Add options.includeReserved and the relevant condition to filter the
matched clients.
- For an environment type client, it references the environment's
target browsing context's active document's UI properties to set the
visibilityState and the focused state.
Related commit: 8b483b0
<li>If <var>client</var> is a type of <a>environment</a>, set <var>browsingContext</var> to <var>client</var>’s <a for="environment">target browsing context</a>.</li>
1289
1290
<li>Else, set <var>browsingContext</var> to <var>client</var>'s <a for="environment settings object">global object</a>'s <a for="/">browsing context</a>.</li>
1290
-
<li><a>Queue a task</a><var>task</var> to run the following substeps:
1291
+
<li><a>Queue a task</a><var>task</var> to run the following substeps on <var>browsingContext</var>'s <a>event loop</a> using the <a>user interaction task source</a>:
1291
1292
<ol>
1292
1293
<li>Set <var>visibilityState</var> to <var>browsingContext</var>'s <a>active document</a>'s {{Document/visibilityState}} attribute value.</li>
1293
1294
<li>Set <var>focusState</var> to the result of running the <a>has focus steps</a> with <var>browsingContext</var>'s <a>active document</a> as the argument.</li>
<li>Let <var>targetClients</var> be an empty array.</li>
1326
1327
<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 associated <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>'s <a for="resource">origin</a>:
1328
+
<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>
1327
1329
<ol>
1328
-
<li>If <var>client</var> is not a <a>secure context</a>, continue to the next iteration of the loop.</li>
1329
-
<li>If <var>options</var>.{{ClientQueryOptions/includeUncontrolled}} is false, then:
1330
+
<li>If <var>client</var> is a type of <a>environment</a>, then:
1330
1331
<ol>
1331
-
<li>If <var>client</var>'s <a>active service worker</a> is the associated<a href="#dfn-service-worker-global-scope-service-worker">service worker</a>, add <var>client</var>to <var>targetClients</var>.</li>
1332
+
<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>
1332
1333
</ol>
1333
1334
</li>
1334
1335
<li>Else:
1335
1336
<ol>
1336
-
<li>Add <var>client</var> to <var>targetClients</var>.</li>
1337
+
<li>If <var>client</var> is not a <a>secure context</a>, continue to the next iteration of the loop.</li>
1338
+
</ol>
1339
+
</li>
1340
+
<li>If <var>options</var>.{{ClientQueryOptions/includeUncontrolled}} is false, then:
1341
+
<ol>
1342
+
<li>If <var>client</var>'s <a>active service worker</a> is not the associated <a href="#dfn-service-worker-global-scope-service-worker">service worker</a>, continue to the next iteration of the loop.</li>
1337
1343
</ol>
1338
1344
</li>
1345
+
<li>If <var>options</var>.{{ClientQueryOptions/includeReserved}} is false, then:
1346
+
<ol>
1347
+
<li>If <var>client</var>'s <a>execution ready flag</a> is unset, continue to the next iteration of the loop.</li>
1348
+
</ol>
1349
+
</li>
1350
+
<li>Add <var>client</var> to <var>targetClients</var>.</li>
1339
1351
</ol>
1340
1352
</li>
1341
1353
<li>Let <var>matchedClients</var> be an empty array.</li>
1342
1354
<li>For each <a href="#dfn-service-worker-client">service worker client</a><var>client</var> in <var>targetClients</var>, in the most recently <a lt="focusing steps">focused</a> order for <a href="#dfn-window-client">window clients</a>:
1343
1355
<ol>
1344
-
<li>If <var>options</var>.{{ClientQueryOptions/type}} is "<code>window</code>", and <var>client</var> is a <a href="#dfn-window-client">window client</a>, then:
1356
+
<li>If <var>options</var>.{{ClientQueryOptions/type}} is "<code>window</code>" or "<code>all</code>", and <var>client</var> is a type of <a>environment</a> or is a <a href="#dfn-window-client">window client</a>, then:
<li>Let <var>isClientEnumerable</var> be false.</li>
1358
+
<li>Let <var>browsingContext</var> be null.</li>
1359
+
<li>Let <var>isClientEnumerable</var> be true.</li>
1348
1360
<li>Let <var>visibilityState</var> be the empty string.</li>
1349
1361
<li>Let <var>focusState</var> be false.</li>
1350
-
<li><a>Queue a task</a><var>task</var> to run the following substep on <var>client</var>'s <a>responsible event loop</a> using the <a>user interaction task source</a>:
1362
+
<li>If <var>client</var> is a type of <a>environment</a>, set <var>browsingContext</var> to <var>client</var>’s <a for="environment">target browsing context</a>.</li>
1363
+
<li>Else, set <var>browsingContext</var> to <var>client</var>'s <a for="environment settings object">global object</a>'s <a for="/">browsing context</a>.</li>
1364
+
<li><a>Queue a task</a><var>task</var> to run the following substeps on <var>browsingContext</var>'s <a>event loop</a> using the <a>user interaction task source</a>:
1351
1365
<ol>
1352
-
<li>If <var>browsingContext</var> has not been <a lt="a browsing context is discarded">discarded</a> and <var>client</var>'s <a>responsible document</a> is <var>browsingContext</var>'s <a>active document</a>, then:
1353
-
<ol>
1354
-
<li>Set <var>visibilityState</var> to <var>browsingContext</var>'s <a>active document</a>'s {{Document/visibilityState}} attribute value.</li>
1355
-
<li>Set <var>focusState</var> to the result of running the <a>has focus steps</a> with <var>browsingContext</var>'s <a>active document</a> as the argument.</li>
1356
-
<li>Set <var>isClientEnumerable</var> to true.</li>
1357
-
</ol>
1358
-
</li>
1366
+
<li>If <var>browsingContext</var> has been <a lt="a browsing context is discarded">discarded</a>, set <var>isClientEnumerable</var> to false and abort these steps.</li>
1367
+
<li>If <var>client</var> is a window client and <var>client</var>'s <a>responsible document</a> is not <var>browsingContext</var>'s <a>active document</a>, set <var>isClientEnumerable</var> to false and abort these steps.</li>
1368
+
<li>Set <var>visibilityState</var> to <var>browsingContext</var>'s <a>active document</a>'s {{Document/visibilityState}} attribute value.</li>
1369
+
<li>Set <var>focusState</var> to the result of running the <a>has focus steps</a> with <var>browsingContext</var>'s <a>active document</a> as the argument.</li>
<li>Else if <var>options</var>.{{ClientQueryOptions/type}} is "<code>worker</code>" and <var>client</var> is a <a href="#dfn-dedicatedworker-client">dedicated worker client</a>, or <var>options</var>.{{ClientQueryOptions/type}} is "<code>sharedworker</code>" and <var>client</var> is a <a href="#dfn-sharedworker-client">shared worker client</a>, then:
1383
+
<li>Else if <var>options</var>.{{ClientQueryOptions/type}} is "<code>worker</code>" or "<code>all</code>" and <var>client</var> is a <a href="#dfn-dedicatedworker-client">dedicated worker client</a>, or <var>options</var>.{{ClientQueryOptions/type}} is "<code>sharedworker</code>" or "<code>all</code>" and <var>client</var> is a <a href="#dfn-sharedworker-client">shared worker client</a>, then:
1373
1384
<ol>
1374
1385
<li>Let <var>clientObject</var> be the result of running <a href="#create-client-algorithm">Create Client</a> algorithm with <var>client</var> as the argument.</li>
1375
1386
<li>Add <var>clientObject</var> to <var>matchedClients</var>.</li>
1376
1387
</ol>
1377
1388
</li>
1378
-
<li>Else if <var>options</var>.{{ClientQueryOptions/type}} is "<code>all</code>", then:
1379
-
<ol>
1380
-
<li>If <var>client</var> is a <a href="#dfn-window-client">window client</a>, then:
<li>Let <var>isClientEnumerable</var> be false.</li>
1384
-
<li>Let <var>visibilityState</var> be the empty string.</li>
1385
-
<li>Let <var>focusState</var> be false.</li>
1386
-
<li><a>Queue a task</a><var>task</var> to run the following substep on <var>client</var>'s <a>responsible event loop</a> using the <a>user interaction task source</a>:
1387
-
<ol>
1388
-
<li>If <var>browsingContext</var> has not been <a lt="a browsing context is discarded">discarded</a> and <var>client</var>'s <a>responsible document</a> is <var>browsingContext</var>'s <a>active document</a>, then:
1389
-
<ol>
1390
-
<li>Set <var>visibilityState</var> to <var>browsingContext</var>'s <a>active document</a>'s {{Document/visibilityState}} attribute value.</li>
1391
-
<li>Set <var>focusState</var> to the result of running the <a>has focus steps</a> with <var>browsingContext</var>'s <a>active document</a> as the argument.</li>
1392
-
<li>Set <var>isClientEnumerable</var> to true.</li>
1393
-
</ol>
1394
-
</li>
1395
-
</ol>
1396
-
</li>
1397
-
<li>Wait for <var>task</var> to have executed.
1398
-
<p class="note">Wait is a blocking wait, but implementers may run the iterations in parallel as long as the state is not broken.</p>
1399
-
</li>
1400
-
<li>If <var>isClientEnumerable</var> is true, then:
1401
-
<ol>
1402
-
<li>Let <var>windowClient</var> be the result of running <a href="#create-windowclient-algorithm">Create Window Client</a> algorithm with <var>client</var>, <var>visibilityState</var> and <var>focusState</var> as the arguments.</li>
1403
-
<li>Add <var>windowClient</var> to <var>matchedClients</var>.</li>
1404
-
</ol>
1405
-
</li>
1406
-
</ol>
1407
-
</li>
1408
-
<li>Else:
1409
-
<ol>
1410
-
<li>Let <var>clientObject</var> be the result of running <a href="#create-client-algorithm">Create Client</a> algorithm with <var>client</var> as the argument.</li>
1411
-
<li>Add <var>clientObject</var> to <var>matchedClients</var>.</li>
1412
-
</ol>
1413
-
</li>
1414
-
</ol>
1415
1389
</ol>
1416
1390
</li>
1417
1391
<li>Resolve <var>promise</var> with <var>matchedClients</var>.</li>
0 commit comments