diff --git a/spec/service_worker/index.html b/spec/service_worker/index.html index 7dc6c2ba..4832d3cc 100644 --- a/spec/service_worker/index.html +++ b/spec/service_worker/index.html @@ -351,7 +351,7 @@

unregister()

  1. Let scopeURL be the scope url of the service worker registration.
  2. -
  3. Return the result of running the Unregister algorithm, or their equivalent, passing the service worker client client, and scopeURL as the arguments.
  4. +
  5. Return the result of running the Unregister algorithm, or its equivalent, passing the service worker client client, and scopeURL as the arguments.
@@ -488,7 +488,7 @@

register(scriptURL, options)

The scope url for the registration is set to the location of the service worker script by default.

  • Else, set scopeURL to the result of parsing options.scope with entry settings object's API base URL.
  • If scopeURL is failure, return a promise rejected with a TypeError.
  • -
  • Return the result of running the Register algorithm, or their equivalent, passing the service worker client client, scriptURL, scopeURL as the arguments.
  • +
  • Return the result of running the Register algorithm, or its equivalent, passing the service worker client client, scriptURL, scopeURL as the arguments.
  • @@ -800,8 +800,8 @@

    Client

    [Exposed=ServiceWorker] interface WindowClient : Client { - readonly attribute VisibilityState visibilityState; - readonly attribute boolean focused; + readonly attribute VisibilityState visibilityState; + readonly attribute boolean focused; readonly attribute FrameType frameType; Promise<WindowClient> focus(); }; @@ -815,27 +815,26 @@

    Client

    A Client object has an associated service worker client (a service worker client).

    - -

    focus()

    -

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

    - -
      -
    1. If this algorithm is not allowed to show a popup, return a promise rejected with a "InvalidAccessError" exception.
    2. -
    3. Let promise be a new promise.
    4. -
    5. Run these steps in parallel: -
        -
      1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
      2. -
      3. Queue a task to run the following substeps on the context object's associated service worker client's responsible event loop using the user interaction task source: -
          -
        1. Run the focusing steps with browsingContext.
        2. -
        3. Resolve promise with a new WindowClient representing browsingContext.
        4. -
        -
      4. -
      -
    6. -
    7. Return promise.
    8. -
    -
    +

    A WindowClient object has an associated visibility state, which is one of visibilityState attribute value.

    + +

    A WindowClient object has an associated focus state, which is either true or false. (Initially false).

    + + +

    url

    + +

    The url attribute must return the context object's associated service worker client's serialized creation url.

    +
    + + +

    visibilityState

    + +

    The visibilityState attribute must return the context object's visibility state.

    +
    + + +

    focused

    + +

    The focused attribute must return the context object's focus state.

    @@ -861,7 +860,28 @@

    frameType

    -

    This section will be updated as per SW #588.

    + +

    focus()

    +

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

    + +
      +
    1. If this algorithm is not allowed to show a popup, return a promise rejected with a "InvalidAccessError" exception.
    2. +
    3. Let promise be a new promise.
    4. +
    5. Run these steps in parallel: +
        +
      1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
      2. +
      3. Queue a task to run the following substeps on the context object's associated service worker client's responsible event loop using the user interaction task source: +
          +
        1. Run the focusing steps with browsingContext.
        2. +
        3. Resolve promise with the result of running Capture Window Client algorithm, or its equivalent, with browsingContext as the argument.
        4. +
        +
      4. +
      +
    6. +
    7. Return promise.
    8. +
    +
    +

    Clients

    @@ -900,7 +920,12 @@

    getAll(options)

    1. For each service worker client client whose active worker is the associated service worker, in the most recently focused order for window clients:
        -
      1. If client is a window client, add a WindowClient object that represents client to clients.
      2. +
      3. If client is a window client, then: +
          +
        1. Let windowClient be the result of running Capture Window Client algorithm, or its equivalent, with client's responsible browsing context as the argument.
        2. +
        3. Add windowClient to clients.
        4. +
        +
    2. Resolve promise with clients.
    3. @@ -926,12 +951,22 @@

      getAll(options)

    4. Let matchedClients be an empty array.
    5. For each service worker client client in targetClients, in the most recently focused order for window clients:
        -
      1. If options.type is "window", and client is a window client, add a WindowClient object that represents client to matchedClients.
      2. +
      3. If options.type is "window", and client is a window client, then: +
          +
        1. Let windowClient be the result of running Capture Window Client algorithm, or its equivalent, with client's responsible browsing context as the argument.
        2. +
        3. Add windowClient to matchedClients.
        4. +
        +
      4. Else if options.type is "worker" and client is a dedicated worker client, add a Client object that represents client to matchedClients.
      5. Else if options.type is "sharedworker" and clientis a shared worker client, add a Client object that represents client to matchedClients.
      6. Else if options.type is "all", then:
          -
        1. If client is a window client, add a WindowClient object that represents client to matchedClients.
        2. +
        3. If client is a window client, then: +
            +
          1. Let windowClient be the result of running Capture Window Client algorithm, or its equivalent, with client's responsible browsing context as the argument.
          2. +
          3. Add windowClient to matchedClients.
          4. +
          +
        4. Else, add a Client object that represents client to matchedClients.
      @@ -973,7 +1008,7 @@

      openWindow(url)

    6. Abort these steps.
    -
  • Let client be a new WindowClient representing newContext.
  • +
  • Let client be the result of running Capture Window Client algorithm, or its equivalent, with newContext as the argument.
  • Resolve promise with client.
  • @@ -2011,7 +2046,7 @@

    Define

    Request Functional Event Dispatch

    -

    To request a functional event dispatch to a service worker, specifications may invoke Handle Functional Event algorithm with its service worker registration registration and the algorithm callbackSteps as the arguments.

    +

    To request a functional event dispatch to a service worker, specifications may invoke Handle Functional Event algorithm, or its equivalent, with its service worker registration registration and the algorithm callbackSteps as the arguments.

    Specifications may define an algorithm callbackSteps where the corresponding functional event can be created and fired with specification specific objects. The algorithm is passed globalObject (a ServiceWorkerGlobalScope object) at which it may fire its functional events. This algorithm is called on a task run by Handle Functional Event On Scheduled Task algorithm which is queued by Handle Functional Event algorithm.

    @@ -2704,7 +2739,7 @@

    Handle Functional Event

    None
      -
    1. Queue a task to run Handle Functional Event On Scheduled Task algorithm with registration and callbackSteps.
    2. +
    3. Queue a task to run Handle Functional Event On Scheduled Task algorithm, or its equivalent, with registration and callbackSteps.

    Event loop and task queuing model for this algorithm will be specified.

    @@ -2990,6 +3025,25 @@

    Get Newest Worker

    + +

    Capture Window Client

    + + +
    +
    Input
    +
    browsingContext, a browsing context
    +
    Output
    +
    windowClient, a WindowClient object
    +
    +
      +
    1. Let windowClient be a new WindowClient object representing browsingContext.
    2. +
    3. Set windowClient's visibility state to browsingContext's active document's visibilityState attribute value.
    4. +
    5. Set windowClient's focus state to the result of running browsingContext's active document's hasFocus() method.
    6. +
    7. Return windowClient.
    8. +
    +
    +
    +

    Query Cache