Skip to content

Commit 574db3b

Browse files
committed
Add client.type
This adds a type attribute to Client interface. Before this, we could only differentiate the WindowClient objects from Client objects. With the type attribute, a client can be identified as one of window, dedicated worker, and shared worker. Fixes #1005.
1 parent ddf95c3 commit 574db3b

File tree

4 files changed

+250
-166
lines changed

4 files changed

+250
-166
lines changed

docs/index.bs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
866866
interface Client {
867867
readonly attribute USVString url;
868868
readonly attribute DOMString id;
869+
readonly attribute ClientType type;
869870
readonly attribute boolean reserved;
870871
void postMessage(any message, optional sequence<object> transfer = []);
871872
};
@@ -902,6 +903,16 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
902903
The <dfn attribute for="Client"><code>id</code></dfn> attribute *must* return its associated [=Client/service worker client=]'s [=environment/id=].
903904
</section>
904905

906+
<section>
907+
<h4 id="client-type">{{Client/type}}</h4>
908+
909+
The <dfn attribute for="Client"><code>type</code></dfn> attribute *must* run these steps:
910+
911+
1. If the [=context object=]'s [=Client/service worker client=] is a type of [=environment=] or is a [=window client=], return {{ClientType/"window"}}.
912+
1. Else if the [=context object=]'s [=Client/service worker client=] is a [=dedicated worker client=], return {{ClientType/"worker"}}.
913+
1. Else if the [=context object=]'s [=Client/service worker client=] is a [=shared worker client=], return {{ClientType/"sharedworker"}}.
914+
</section>
915+
905916
<section>
906917
<h4 id="client-reserved">{{Client/reserved}}</h4>
907918

0 commit comments

Comments
 (0)