From a48280761a99a7c5703275eba462264433f9c912 Mon Sep 17 00:00:00 2001 From: Matt Falkenhagen Date: Fri, 11 Jun 2021 07:08:13 +0900 Subject: [PATCH] Handle non-fully active clients. --- docs/index.bs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/index.bs b/docs/index.bs index c0b02529..83504e09 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -83,6 +83,8 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ text: delay the load event; for: document; url: delay-the-load-event urlPrefix: origin.html text: creating a policy container from a fetch response + urlPrefix: workers.html + text: active needed worker spec: fetch; urlPrefix: https://fetch.spec.whatwg.org/ type: dfn @@ -274,6 +276,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 A shared worker client is a [=/service worker client=] whose [=environment settings object/global object=] is a {{SharedWorkerGlobalScope}} object. A worker client is either a dedicated worker client or a shared worker client. + + A [=/service worker client=] is said to be a fully active client if either of the following is true: + * It is a [=window client=] whose [=responsible document=] is [=fully active=]. + * It is a [=worker client=] that is an [=active needed worker=]. + + To discard a client, given a [=/service worker client=] |client|, run the following steps: + 1. If |client| is a [=window client=], then [=discard a document|discard=] its [=responsible document=]. + 2. Else if |client| is a [=worker client=], then [=terminate a worker|terminate=] it.
@@ -1331,6 +1341,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 1. Run these substeps in parallel: 1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the same as the associated [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]: 1. If |client|'s [=environment/id=] is not |id|, [=continue=]. + 1. If |client| is not a [=fully active client=], [=break=]. 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|, and abort these steps. 1. Resolve |promise| with undefined. @@ -1347,6 +1358,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 1. Let |targetClients| be a new [=list=]. 1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the [=same origin|same=] as the associated [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]: 1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=]. + 1. If |client| is not a [=fully active client=], [=continue=]. 1. If |client| is not a [=secure context=], [=continue=]. 1. If |options|["{{ClientQueryOptions/includeUncontrolled}}"] is false, and if |client|'s [=active service worker=] is not the associated [=ServiceWorkerGlobalScope/service worker=], [=continue=]. 1. Add |client| to |targetClients|. @@ -1429,6 +1441,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 1. Run the following substeps in parallel: 1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the same as the [=ServiceWorkerGlobalScope/service worker=]'s [=environment settings object/origin=]: 1. If |client|'s [=environment/execution ready flag=] is unset or |client|'s [=discarded flag=] is set, [=continue=]. + 1. If |client| is not a [=fully active client=], [=discard a client|discard=] it and [=continue=]. 1. If |client| is not a [=secure context=], [=continue=]. 1. Let |registration| be the result of running Match Service Worker Registration algorithm passing |client|'s creation URL as the argument. 1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s containing service worker registration, [=continue=].