diff --git a/docs/index.bs b/docs/index.bs
index 35b0eddf..e824b1b2 100644
--- a/docs/index.bs
+++ b/docs/index.bs
@@ -1148,27 +1148,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
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 to the next iteration of the loop.
- 1. If |client| is an [=environment settings object=], then:
- 1. If |client| is not a secure context, reject |promise| with a "{{SecurityError}}" {{DOMException}} and abort these steps.
- 1. Else:
- 1. If |client|’s creation URL is not a potentially trustworthy URL, reject |promise| with a "{{SecurityError}}" {{DOMException}} and abort these steps.
- 1. If |client| is an [=environment settings object=] and is not a [=window client=], then:
- 1. Let |clientObject| be the result of running Create Client algorithm with |client| as the argument.
- 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. 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| and abort these steps.
+ 1. If |client|'s [=environment/execution ready flag=] is not unset, set the [=/get client promise] for |client| to |promise| and abort these steps.
+ 1. Invoke [[=Resolve Get Client Promise=]] with |client| and |promise|.
1. Resolve |promise| with undefined.
1. Return |promise|.
@@ -3216,6 +3197,40 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
Note: When an exception is [=throw|thrown=], the implementation does undo (roll back) any changes made to the cache storage during the batch operation job.
+
+
+ Resolve Get Client Promise Algorithm
+
+ : Input
+ :: |client|, a [=/service worker client=]
+ :: |promise|, a promise
+
+ : Output
+ :: none
+
+ 1. If |client| is an [=environment settings object=], then:
+ 1. If |client| is not a secure context, reject |promise| with a "{{SecurityError}}" {{DOMException}} and return.
+ 1. Else:
+ 1. If |client|’s creation URL is not a potentially trustworthy URL, reject |promise| with a "{{SecurityError}}" {{DOMException}} and return.
+ 1. If |client| is an [=environment settings object=] and is not a [=window client=], then:
+ 1. Let |clientObject| be the result of running Create Client algorithm with |client| as the argument.
+ 1. Resolve |promise| with |clientObject| and return.
+ 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. 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| and return.
+
+