Skip to content

Commit

Permalink
Add client.type
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jungkees committed Dec 2, 2016
1 parent ddf95c3 commit 574db3b
Show file tree
Hide file tree
Showing 4 changed files with 250 additions and 166 deletions.
11 changes: 11 additions & 0 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
interface Client {
readonly attribute USVString url;
readonly attribute DOMString id;
readonly attribute ClientType type;
readonly attribute boolean reserved;
void postMessage(any message, optional sequence<object> transfer = []);
};
Expand Down Expand Up @@ -902,6 +903,16 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
The <dfn attribute for="Client"><code>id</code></dfn> attribute *must* return its associated [=Client/service worker client=]'s [=environment/id=].
</section>

<section>
<h4 id="client-type">{{Client/type}}</h4>

The <dfn attribute for="Client"><code>type</code></dfn> attribute *must* run these steps:

1. If the [=context object=]'s [=Client/service worker client=] is a type of [=environment=] or is a [=window client=], return {{ClientType/"window"}}.
1. Else if the [=context object=]'s [=Client/service worker client=] is a [=dedicated worker client=], return {{ClientType/"worker"}}.
1. Else if the [=context object=]'s [=Client/service worker client=] is a [=shared worker client=], return {{ClientType/"sharedworker"}}.
</section>

<section>
<h4 id="client-reserved">{{Client/reserved}}</h4>

Expand Down
Loading

0 comments on commit 574db3b

Please sign in to comment.