diff --git a/spec/service_worker/index.html b/spec/service_worker/index.html
index f2a03620..497eb513 100644
--- a/spec/service_worker/index.html
+++ b/spec/service_worker/index.html
@@ -980,7 +980,7 @@
Client
[Exposed=ServiceWorker]
interface Client {
- readonly attribute USVString url;
+ readonly attribute USVString url;
readonly attribute FrameType frameType;
readonly attribute DOMString id;
void postMessage(any message, optional sequence<Transferable> transfer);
@@ -1171,6 +1171,7 @@ Clients
[Exposed=ServiceWorker]
interface Clients {
// The objects returned will be new instances every time
+ [NewObject] Promise<any> get(DOMString id);
[NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
[NewObject] Promise<WindowClient?> openWindow(USVString url);
[NewObject] Promise<void> claim();
@@ -1190,6 +1191,53 @@ Clients
The user agent must create a Clients
object when a ServiceWorkerGlobalScope
object is created and associate it with that object.
+
+ get(id)
+ The get(id)
method must run these steps or their equivalent:
+
+
+ - Let promise be a new promise.
+ - Run these substeps in parallel:
+
+ - For each service worker client client whose origin is the same as the associated service worker's origin:
+
+ - If client's id is id, then:
+
+ - If client is not a secure context, reject promise with a "
SecurityError
" exception and abort these steps.
+ - If client is a window client, then:
+
+ - Let browsingContext be client's global object's browsing context.
+ - Let visibilityState be null.
+ - Let focusState be null.
+ - Queue a task task to run the following substeps:
+
+ - Set visibilityState to browsingContext's active document's visibilityState attribute value.
+ - Set focusState to the result of running the has focus steps with browsingContext's active document as the argument.
+
+
+ - Wait for task to have executed.
+ - Let windowClient be the result of running Create Window Client algorithm, or its equivalent, with client, visibilityState and focusState as the arguments.
+ - Resolve promise with windowClient and abort these steps.
+
+
+ - Else:
+
+ - Let clientObject be the result of running Create Client algorithm, or its equivalent, with client as the argument.
+ - Resolve promise with clientObject and abort these steps.
+
+
+
+
+
+
+ - Resolve promise with undefined.
+
+
+ - Return promise.
+
+
+
+
matchAll(options)
The matchAll(options)
method must run these steps or their equivalent:
diff --git a/spec/service_worker_1/index.html b/spec/service_worker_1/index.html
index f77aed2c..b12c8e60 100644
--- a/spec/service_worker_1/index.html
+++ b/spec/service_worker_1/index.html
@@ -978,7 +978,7 @@ Client
[Exposed=ServiceWorker]
interface Client {
- readonly attribute USVString url;
+ readonly attribute USVString url;
readonly attribute FrameType frameType;
readonly attribute DOMString id;
void postMessage(any message, optional sequence<Transferable> transfer);
@@ -1169,6 +1169,7 @@ Clients
[Exposed=ServiceWorker]
interface Clients {
// The objects returned will be new instances every time
+ [NewObject] Promise<any> get(DOMString id);
[NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
[NewObject] Promise<WindowClient?> openWindow(USVString url);
[NewObject] Promise<void> claim();
@@ -1188,6 +1189,53 @@ Clients
The user agent must create a Clients
object when a ServiceWorkerGlobalScope
object is created and associate it with that object.
+
+ get(id)
+ The get(id)
method must run these steps or their equivalent:
+
+
+ - Let promise be a new promise.
+ - Run these substeps in parallel:
+
+ - For each service worker client client whose origin is the same as the associated service worker's origin:
+
+ - If client's id is id, then:
+
+ - If client is not a secure context, reject promise with a "
SecurityError
" exception and abort these steps.
+ - If client is a window client, then:
+
+ - Let browsingContext be client's global object's browsing context.
+ - Let visibilityState be null.
+ - Let focusState be null.
+ - Queue a task task to run the following substeps:
+
+ - Set visibilityState to browsingContext's active document's visibilityState attribute value.
+ - Set focusState to the result of running the has focus steps with browsingContext's active document as the argument.
+
+
+ - Wait for task to have executed.
+ - Let windowClient be the result of running Create Window Client algorithm, or its equivalent, with client, visibilityState and focusState as the arguments.
+ - Resolve promise with windowClient and abort these steps.
+
+
+ - Else:
+
+ - Let clientObject be the result of running Create Client algorithm, or its equivalent, with client as the argument.
+ - Resolve promise with clientObject and abort these steps.
+
+
+
+
+
+
+ - Resolve promise with undefined.
+
+
+ - Return promise.
+
+
+
+
matchAll(options)
The matchAll(options)
method must run these steps or their equivalent: