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

mattto commented on this pull request.



> +          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|.

That's a great question! See https://github.com/w3c/ServiceWorker/issues/1316, it turns out the HTML and/or Fetch spec has a bug around clients persisting across cross-origin redirects. I was planning on tackling that next.

In the case where the client is discarded, it's expected to never reach execution ready so will never be exposed.

-- 
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_r195115867

Received on Wednesday, 13 June 2018 14:56:44 UTC