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:

+ +
    +
  1. Let promise be a new promise.
  2. +
  3. Run these substeps in parallel: +
      +
    1. For each service worker client client whose origin is the same as the associated service worker's origin: +
        +
      1. If client's id is id, then: +
          +
        1. If client is not a secure context, reject promise with a "SecurityError" exception and abort these steps.
        2. +
        3. If client is a window client, then: +
            +
          1. Let browsingContext be client's global object's browsing context.
          2. +
          3. Let visibilityState be null.
          4. +
          5. Let focusState be null.
          6. +
          7. Queue a task task to run the following substeps: +
              +
            1. Set visibilityState to browsingContext's active document's visibilityState attribute value.
            2. +
            3. Set focusState to the result of running the has focus steps with browsingContext's active document as the argument.
            4. +
            +
          8. +
          9. Wait for task to have executed.
          10. +
          11. Let windowClient be the result of running Create Window Client algorithm, or its equivalent, with client, visibilityState and focusState as the arguments.
          12. +
          13. Resolve promise with windowClient and abort these steps.
          14. +
          +
        4. +
        5. Else: +
            +
          1. Let clientObject be the result of running Create Client algorithm, or its equivalent, with client as the argument.
          2. +
          3. Resolve promise with clientObject and abort these steps.
          4. +
          +
        6. +
        +
      2. +
      +
    2. +
    3. Resolve promise with undefined.
    4. +
    +
  4. +
  5. Return promise.
  6. +
+
+
+

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:

+ +
    +
  1. Let promise be a new promise.
  2. +
  3. Run these substeps in parallel: +
      +
    1. For each service worker client client whose origin is the same as the associated service worker's origin: +
        +
      1. If client's id is id, then: +
          +
        1. If client is not a secure context, reject promise with a "SecurityError" exception and abort these steps.
        2. +
        3. If client is a window client, then: +
            +
          1. Let browsingContext be client's global object's browsing context.
          2. +
          3. Let visibilityState be null.
          4. +
          5. Let focusState be null.
          6. +
          7. Queue a task task to run the following substeps: +
              +
            1. Set visibilityState to browsingContext's active document's visibilityState attribute value.
            2. +
            3. Set focusState to the result of running the has focus steps with browsingContext's active document as the argument.
            4. +
            +
          8. +
          9. Wait for task to have executed.
          10. +
          11. Let windowClient be the result of running Create Window Client algorithm, or its equivalent, with client, visibilityState and focusState as the arguments.
          12. +
          13. Resolve promise with windowClient and abort these steps.
          14. +
          +
        4. +
        5. Else: +
            +
          1. Let clientObject be the result of running Create Client algorithm, or its equivalent, with client as the argument.
          2. +
          3. Resolve promise with clientObject and abort these steps.
          4. +
          +
        6. +
        +
      2. +
      +
    2. +
    3. Resolve promise with undefined.
    4. +
    +
  4. +
  5. Return promise.
  6. +
+
+
+

matchAll(options)

The matchAll(options) method must run these steps or their equivalent: