Re: [w3c/ServiceWorker] Clients.get: block on reserved clients. (#1323)

jakearchibald commented on this pull request.

Only got questions this time round.

> @@ -222,6 +222,13 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
 
     A <dfn export id="dfn-service-worker-client" for="">service worker client</dfn> is an [=environment=].
 
+    A [=/service worker client=] has an associated <dfn export>discarded flag</dfn>. It is initially unset.
+
+   Each [=/service worker client=] has the following [=environment discarding steps=]:
+        1. Set |client|'s [=discarded flag=].
+
+    Note: Implementations can discard clients whose [=discarded flag=] is set.

"Implementations can discard clients" sounds normative, but maybe it's defined somewhere else? Otherwise, add it to the definition of the flag. Eg:

```
A [=/service worker client=] has an associated <dfn export>discarded flag</dfn>. It is initially unset. User agents may discard clients whose [=discarded flag=] is set.
```

(it looks like we tend to say "user agents" rather than "implementations")

> +          1. Resolve |promise| with |clientObject| and abort these steps.
+      1. Else:
+          1. Let |browsingContext| be null.
+          1. Let |visibilityState| be null.
+          1. Let |focusState| be false.
+          1. Let |ancestorOriginsList| be the empty list.
+          1. If |client| is an [=environment settings object=], set |browsingContext| to |client|'s [=environment settings object/global object=]'s [=/browsing context=].
+          1. Else, set |browsingContext| to |client|’s [=environment/target browsing context=].
+          1. [=Queue a task=] |task| to run the following substeps on |browsingContext|'s [=event loop=] using the [=user interaction task source=]:
+              1. Set |visibilityState| to |browsingContext|'s [=active document=]'s {{Document/visibilityState}} attribute value.
+              1. Set |focusState| to the result of running the [=has focus steps=] with |browsingContext|'s [=active document=] as the argument.
+              1. If |client| is a [=window client=], set |ancestorOriginsList| to |browsingContext|'s [=active document=]'s [=relevant global object=]'s {{Location}} object's [=Location/ancestor origins list=]'s associated list.
+          1. Wait for |task| to have executed.
+          1. If |client|'s [=discarded flag=] is set, resolve |promise| with undefined and abort these steps.
+          1. Let |windowClient| be the result of running [=Create Window Client=] algorithm with |client|, |visibilityState|, |focusState|, and |ancestorOriginsList| as the arguments.
+          1. Resolve |promise| with |windowClient|.

This might be a silly question, but is it possible for a client to end up representing another origin, or is the client discarded and a new one created in that case?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1323#pullrequestreview-128405390

Received on Wednesday, 13 June 2018 14:38:39 UTC