Skip to content

Commit

Permalink
Add the 'service worker client' for Client objects representing Servi…
Browse files Browse the repository at this point in the history
…ceWorkerGlobalScope. Fixes w3c#1036

This adds a "serviceworker" `ClientType` and the associated "service worker
client" object.  It also adds a check to avoid having `clients.matchAll()`
return a `Client` for the current environment.
  • Loading branch information
wanderview committed Feb 15, 2017
1 parent cea9f48 commit e420507
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe

A <dfn export id="dfn-sharedworker-client">shared worker client</dfn> is a [=/client=] whose [=environment settings object/global object=] is a {{SharedWorkerGlobalScope}} object.

A <dfn export id="dfn-worker-client">worker client</dfn> is either a <a>dedicated worker client</a> or a <a>shared worker client</a>.
A <dfn export id="dfn-serviceworker-client">service worker client</dfn> is a [=/client=] whose [=environment settings object/global object=] is a {{ServiceWorkerGlobalScope}} object.

A <dfn export id="dfn-worker-client">worker client</dfn> is a <a>dedicated worker client</a>, a <a>shared worker client</a>, or a <a>service worker client</a>.
</section>

<section>
Expand Down Expand Up @@ -999,6 +1001,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
1. If the [=context object=]'s [=Client/client=] is a type of [=environment=] or is a [=window client=], return {{ClientType/"window"}}.
1. Else if the [=context object=]'s [=Client/client=] is a [=dedicated worker client=], return {{ClientType/"worker"}}.
1. Else if the [=context object=]'s [=Client/client=] is a [=shared worker client=], return {{ClientType/"sharedworker"}}.
1. Else if the [=context object=]'s [=Client/client=] is a [=service worker client=], return {{ClientType/"serviceworker"}}.
</section>

<section>
Expand Down Expand Up @@ -1129,6 +1132,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
"window",
"worker",
"sharedworker",
"serviceworker",
"all"
};
</pre>
Expand Down Expand Up @@ -1189,6 +1193,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
1. Add |client| to |targetClients|.
1. Let |matchedClients| be an empty array.
1. For each [=/client=] |client| in |targetClients|:
1. If |client|'s [=environment settings object/global object=] is the [=current global object=], then continue to the next iteration of the loop.
1. If |options|.{{ClientQueryOptions/type}} is {{ClientType/"window"}} or {{ClientType/"all"}}, and |client| is a type of <a>environment</a> or is a <a>window client</a>, then:
1. Let |browsingContext| be null.
1. Let |isClientEnumerable| be true.
Expand All @@ -1210,7 +1215,13 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
1. If |isClientEnumerable| is true, then:
1. Let |windowClient| be the result of running <a>Create Window Client</a> algorithm with |client|, |visibilityState|, |focusState|, and |ancestorOrigins| as the arguments.
1. Add |windowClient| to |matchedClients|.
1. Else if |options|.{{ClientQueryOptions/type}} is {{ClientType/"worker"}} or {{ClientType/"all"}} and |client| is a <a>dedicated worker client</a>, or |options|.{{ClientQueryOptions/type}} is {{ClientType/"sharedworker"}} or {{ClientType/"all"}} and |client| is a <a>shared worker client</a>, then:
1. Else if |options|.{{ClientQueryOptions/type}} is {{ClientType/"worker"}} or {{ClientType/"all"}} and |client| is a <a>dedicated worker client</a>, then:
1. Let |clientObject| be the result of running <a>Create Client</a> algorithm with |client| as the argument.
1. Add |clientObject| to |matchedClients|.
1. Else if |options|.{{ClientQueryOptions/type}} is {{ClientType/"sharedworker"}} or {{ClientType/"all"}} and |client| is a <a>shared worker client</a>, then:
1. Let |clientObject| be the result of running <a>Create Client</a> algorithm with |client| as the argument.
1. Add |clientObject| to |matchedClients|.
1. Else if |options|.{{ClientQueryOptions/type}} is {{ClientType/"serviceworker"}} or {{ClientType/"all"}} and |client| is a <a>service worker client</a>, then:
1. Let |clientObject| be the result of running <a>Create Client</a> algorithm with |client| as the argument.
1. Add |clientObject| to |matchedClients|.
1. Sort |matchedClients| such that:
Expand Down

0 comments on commit e420507

Please sign in to comment.