From aeee6b9d5fa3eb071cb9667f1d599ecf90a78410 Mon Sep 17 00:00:00 2001 From: Jungkee Song Date: Fri, 23 Jan 2015 16:06:35 +0900 Subject: [PATCH] Specify Clients.claim() --- spec/service_worker/index.html | 41 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/spec/service_worker/index.html b/spec/service_worker/index.html index 74f8c01e..d8934f36 100644 --- a/spec/service_worker/index.html +++ b/spec/service_worker/index.html @@ -822,7 +822,8 @@

Clients

interface Clients { // The objects returned will be new instances every time Promise<sequence<Client>?> getAll(optional ClientQueryOptions options); - Promise<WindowClient> openWindow(USVString url); + Promise<WindowClient> openWindow(USVString url); + Promise<void> claim(); }; dictionary ClientQueryOptions { @@ -838,7 +839,7 @@

Clients

};

The Clients interface represents a container for a list of Client objects.

- +

getAll(options)

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

@@ -895,11 +896,10 @@

getAll(options)

  • Return promise.
  • -

    This section will be updated as per SW #588.

    - +

    openWindow(url)

    -

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

    +

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

    1. Let url be the result of parsing url with entry settings object's API base URL.
    2. @@ -934,6 +934,35 @@

      openWindow(url)

      Creating a client is yet to be defined.

      + + +

      claim()

      +

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

      + +
        +
      1. If the service worker is not an active worker, return a promise rejected with an "InvalidStateError" exception.
      2. +
      3. Let promise be a new promise.
      4. +
      5. Run the following substeps in parallel: +
          +
        1. For each service worker client client whose origin is the same as the service worker's origin: +
            +
          1. Let registration be the result of running Match Service Worker Registration algorithm passing client's creation url as the argument.
          2. +
          3. If registration is not the service worker's containing service worker registration, continue to the next iteration of the loop.
          4. +
          5. If client's active worker is not the service worker, then: +
              +
            1. Set client's active worker to service worker.
            2. +
            3. Queue a task to fire a simple event named controllerchange at the ServiceWorkerContainer object client is associated with.
            4. +
            +
          6. +
          +
        2. +
        3. Resolve promise with undefined.
        4. +
        +
      6. +
      7. Return promise.
      8. +
      +
      +
      @@ -1102,7 +1131,7 @@

      event.default()

      1. If event's dispatch flag is unset, then:
          -
        1. Return a promise rejected with a "InvalidStateError" exception.
        2. +
        3. Return a promise rejected with an "InvalidStateError" exception.
      2. Let promise be a new promise.