Skip to content

Commit bbe67e1

Browse files
authored
Clean up Clients interface methods (#1332)
As a follow-up of the decision to not expose the reserved client, this change added a filter exclude discarded client. This change also removes the unnecessary branch that checks whether the environment's creation URL is trustworthy as now we're dealing with only the clients that are execution ready. (i.e. the clients must be an environment settings object at least.) Related issue: #1245.
1 parent 1c993db commit bbe67e1

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

docs/index.bs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,12 +1181,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
11811181
1. Run the following steps [=in parallel=]:
11821182
1. Let |targetClients| be a new [=list=].
11831183
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the [=same origin|same=] as the associated [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]:
1184-
1. If |client| is an [=environment settings object=], then:
1185-
1. If |client| is not a [=secure context=], [=continue=].
1186-
1. Else:
1187-
1. If |client|’s [=creation URL=] is not a [=potentially trustworthy URL=], [=continue=].
1184+
1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=].
1185+
1. If |client| is not a [=secure context=], [=continue=].
11881186
1. If |options|["{{ClientQueryOptions/includeUncontrolled}}"] is false, and if |client|'s [=active service worker=] is not the associated [=ServiceWorkerGlobalScope/service worker=], [=continue=].
1189-
1. If |client|'s [=environment/execution ready flag=] is unset, [=continue=].
11901187
1. Add |client| to |targetClients|.
11911188
1. Let |matchedWindowData| be a new [=list=].
11921189
1. Let |matchedClients| be a new [=list=].
@@ -1266,12 +1263,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
12661263
1. Let |promise| be a new <a>promise</a>.
12671264
1. Run the following substeps <a>in parallel</a>:
12681265
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the <a lt="same origin">same</a> as the [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]:
1269-
1. If |client| is an [=environment settings object=], then:
1270-
1. If |client| is not a <a>secure context</a>, continue to the next iteration of the loop.
1271-
1. Else:
1272-
1. If |client|’s <a>creation URL</a> is not a <a>potentially trustworthy URL</a>, continue to the next iteration of the loop.
1266+
1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=].
1267+
1. If |client| is not a [=secure context=], [=continue=].
12731268
1. Let |registration| be the result of running <a>Match Service Worker Registration</a> algorithm passing |client|'s <a>creation URL</a> as the argument.
1274-
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, continue to the next iteration of the loop.
1269+
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, [=continue=].
12751270
1. If |client|'s <a>active service worker</a> is not the [=ServiceWorkerGlobalScope/service worker=], then:
12761271
1. Invoke <a>Handle Service Worker Client Unload</a> with |client| as the argument.
12771272
1. Set |client|'s <a>active service worker</a> to [=ServiceWorkerGlobalScope/service worker=].

docs/v1/index.bs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,12 +1119,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
11191119
1. Run the following steps [=in parallel=]:
11201120
1. Let |targetClients| be a new [=list=].
11211121
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the [=same origin|same=] as the associated [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]:
1122-
1. If |client| is an [=environment settings object=], then:
1123-
1. If |client| is not a [=secure context=], [=continue=].
1124-
1. Else:
1125-
1. If |client|’s [=creation URL=] is not a [=potentially trustworthy URL=], [=continue=].
1122+
1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=].
1123+
1. If |client| is not a [=secure context=], [=continue=].
11261124
1. If |options|["{{ClientQueryOptions/includeUncontrolled}}"] is false, and if |client|'s [=active service worker=] is not the associated [=ServiceWorkerGlobalScope/service worker=], [=continue=].
1127-
1. If |client|'s [=environment/execution ready flag=] is unset, [=continue=].
11281125
1. Add |client| to |targetClients|.
11291126
1. Let |matchedWindowData| be a new [=list=].
11301127
1. Let |matchedClients| be a new [=list=].
@@ -1204,12 +1201,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
12041201
1. Let |promise| be a new <a>promise</a>.
12051202
1. Run the following substeps <a>in parallel</a>:
12061203
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the <a lt="same origin">same</a> as the [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]:
1207-
1. If |client| is an [=environment settings object=], then:
1208-
1. If |client| is not a <a>secure context</a>, continue to the next iteration of the loop.
1209-
1. Else:
1210-
1. If |client|’s <a>creation URL</a> is not a <a>potentially trustworthy URL</a>, continue to the next iteration of the loop.
1204+
1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=].
1205+
1. If |client| is not a [=secure context=], [=continue=].
12111206
1. Let |registration| be the result of running <a>Match Service Worker Registration</a> algorithm passing |client|'s <a>creation URL</a> as the argument.
1212-
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, continue to the next iteration of the loop.
1207+
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, [=continue=].
12131208
1. If |client|'s <a>active service worker</a> is not the [=ServiceWorkerGlobalScope/service worker=], then:
12141209
1. Invoke <a>Handle Service Worker Client Unload</a> with |client| as the argument.
12151210
1. Set |client|'s <a>active service worker</a> to [=ServiceWorkerGlobalScope/service worker=].

0 commit comments

Comments
 (0)