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

mattto commented on this pull request.



> -                    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. <a>Queue a task</a> |task| to run the following substeps on |browsingContext|'s <a>event loop</a> using the <a>user interaction task source</a>:
-                        1. Set |visibilityState| to |browsingContext|'s <a>active document</a>'s {{Document/visibilityState}} attribute value.
-                        1. Set |focusState| to the result of running the <a>has focus steps</a> with |browsingContext|'s <a>active document</a> as the argument.
-                        1. If |client| is a <a>window client</a>, set |ancestorOriginsList| to |browsingContext|'s <a>active document</a>'s <a>relevant global object</a>'s {{Location}} object's [=Location/ancestor origins list=]'s associated list.
-                    1. Wait for |task| to have executed.
-                    1. Let |windowClient| be the result of running <a>Create Window Client</a> algorithm with |client|, |visibilityState|, |focusState|, and |ancestorOriginsList| as the arguments.
-                    1. Resolve |promise| with |windowClient| and abort these steps.
+                1. If |client|'s [=environment/id=] is not |id|, [=continue=].
+                1. Wait for either |client|'s [=environment/execution ready flag=] to be set or for |client|'s [=discarded flag=] to be set.
+                1. If |client|'s [=environment/execution ready flag=] is set, then invoke [=Resolve Get Client Promise=] with |client| and |promise|.
+                1. Else, resolve |promise| with undefined.

Ah actually I think I have this wrong: the break will break out of the "for each" loop only and we'll double resolve the promise after the loop. I'll adjust this to "abort these steps" which I think breaks out of the  "Run these substeps".

-- 
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#discussion_r193921231

Received on Thursday, 7 June 2018 23:58:40 UTC