Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-fully active clients. #1597

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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
urlPrefix: webappapis.html
text: module map; url: module-map
text: resolve a module specifier; url: resolve-a-module-specifier
Expand Down Expand Up @@ -280,6 +282,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
A <dfn export id="dfn-sharedworker-client">shared worker client</dfn> is a [=/service worker 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 [=/service worker client=] is said to be a <dfn>fully active client</dfn> 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 <dfn>discard a client</dfn>, 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.
</section>

<section>
Expand Down Expand Up @@ -1337,6 +1347,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
1. Run these substeps <a>in parallel</a>:
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the <a lt="same origin">same</a> 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.
Expand All @@ -1353,6 +1364,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|.
Expand Down Expand Up @@ -1435,6 +1447,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
1. Run the following substeps <a>in parallel</a>:
1. For each [=/service worker client=] |client| whose [=service worker client/origin=] is the <a lt="same origin">same</a> 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 <a>Match Service Worker Registration</a> algorithm passing |client|'s <a>creation URL</a> as the argument.
1. If |registration| is not the [=ServiceWorkerGlobalScope/service worker=]'s <a>containing service worker registration</a>, [=continue=].
Expand Down