From 04d573404ea16640ff7d7bf8a36f59e6fe8860a2 Mon Sep 17 00:00:00 2001 From: Jungkee Song Date: Wed, 17 Dec 2014 11:01:53 +0900 Subject: [PATCH] Remove ServiceWorkerClient typedef and rename BasicClient to Client --- spec/service_worker/index.html | 61 +++++++++++++++------------------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/spec/service_worker/index.html b/spec/service_worker/index.html index 61c4e237..9fffe690 100644 --- a/spec/service_worker/index.html +++ b/spec/service_worker/index.html @@ -366,7 +366,7 @@

navigator.serviceWorker

partial interface Navigator { readonly attribute ServiceWorkerContainer serviceWorker; -} +}; partial interface WorkerNavigator { readonly attribute ServiceWorkerContainer serviceWorker; @@ -605,7 +605,7 @@

Events

controllerchange Event - The service worker client's active worker changes. (See step 1.10 of the Activate algorithm. The skip waiting flag of a service worker causes activation of the service worker registration to occur while clients are using the service worker registration, navigator.serviceWorker.controller immediately reflects the active worker as the service worker that controls the client.) + The service worker client's active worker changes. (See step 1.10 of the Activate algorithm. The skip waiting flag of a service worker causes activation of the service worker registration to occur while service worker clients are using the service worker registration, navigator.serviceWorker.controller immediately reflects the active worker as the service worker that controls the service worker client.) error @@ -662,9 +662,9 @@

ServiceWorkerGlobalScope

interface ServiceWorkerGlobalScope : WorkerGlobalScope { readonly attribute Cache scriptCache; - // A container for a list of ServiceWorkerClient objects that correspond to + // A container for a list of Client objects that correspond to // browsing contexts (or shared workers) that are on the origin of this SW - readonly attribute ServiceWorkerClients clients; + readonly attribute Clients clients; readonly attribute ServiceWorkerRegistration registration; Promise<void> skipWaiting(); @@ -675,7 +675,7 @@

ServiceWorkerGlobalScope

attribute EventHandler onbeforeevicted; attribute EventHandler onevicted; - // The event.source of these MessageEvents are instances of ServiceWorkerClient + // The event.source of these MessageEvents are instances of Client attribute EventHandler onmessage; // close() method inherited from WorkerGlobalScope should not be accessible. @@ -695,7 +695,7 @@

scriptCache

clients

-

clients attribute must return the ServiceWorkerClients object.

+

clients attribute must return the Clients object.

registration

@@ -706,7 +706,7 @@

registration

skipWaiting()

-

The skipWaiting() method allows this service worker to progress from the registration's waiting position to active even while clients are using the registration.

+

The skipWaiting() method allows this service worker to progress from the registration's waiting position to active even while service worker clients are using the registration.

skipWaiting() method must run these steps or their equivalent:

@@ -769,23 +769,21 @@

Event handlers

-

For onmessage event handler,ServiceWorkerGlobalScope objects act as if they had an implicit MessagePort associated with them. This port is part of a channel that is set up when the worker is created, but it is not exposed. This object must never be garbage collected before the ServiceWorkerGlobalScope object. All messages received by that port must immediately be retargeted at the ServiceWorkerGlobalScope object. That is, an event named message using the MessageEvent interface is dispatched on ServiceWorkerGlobalScope object. The event.source of these MessageEvents are instances of ServiceWorkerClient.

+

For onmessage event handler,ServiceWorkerGlobalScope objects act as if they had an implicit MessagePort associated with them. This port is part of a channel that is set up when the worker is created, but it is not exposed. This object must never be garbage collected before the ServiceWorkerGlobalScope object. All messages received by that port must immediately be retargeted at the ServiceWorkerGlobalScope object. That is, an event named message using the MessageEvent interface is dispatched on ServiceWorkerGlobalScope object. The event.source of these MessageEvents are instances of Client.

- -

ServiceWorkerClient

- -typedef (BasicClient or WindowClient) ServiceWorkerClient; + +

Client

-[Exposed=ServiceWorker] -interface BasicClient { +[Exposed=ServiceWorker] +interface Client { readonly attribute USVString url; readonly attribute ServiceWorkerRegistration? registration; void postMessage(any message, optional sequence<Transferable> transfer); }; [Exposed=ServiceWorker] -interface WindowClient : BasicClient { +interface WindowClient : Client { readonly attribute VisibilityState visibilityState; readonly attribute boolean focused; readonly attribute ContextFrameType frameType; @@ -799,24 +797,21 @@

ServiceWorkerClient

"none" };
- - -

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

+

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

-

This section will be updated as per SW #588.

- -

ServiceWorkerClients

+ +

Clients

[Exposed=ServiceWorker] -interface ServiceWorkerClients { +interface Clients { // The objects returned will be new instances every time - Promise<sequence<ServiceWorkerClient>?> getAll(optional ServiceWorkerClientQueryOptions options); + Promise<sequence<Client>?> getAll(optional ClientQueryOptions options); Promise<WindowClient> openWindow(USVString url); }; -dictionary ServiceWorkerClientQueryOptions { +dictionary ClientQueryOptions { boolean includeUncontrolled = false; ClientType type = "window"; }; @@ -828,12 +823,10 @@

ServiceWorkerClients

"all" };
- - -

The ServiceWorkerClients interface represents a container for a list of ServiceWorkerClient objects.

+

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:

+

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

  1. Let promise be a new promise.
  2. @@ -863,12 +856,12 @@

    getAll(options)

  3. For each service worker client client in targetClients:
    1. If options.type is omitted or set to "window", and client's global object is a Window object, add a WindowClient object that represents client to matchedClients.
    2. -
    3. Else if options.type is "worker" and client's global object is a DedicatedWorkerGlobalObject object, add a BasicClient object that represents client to matchedClients.
    4. -
    5. Else if options.type is "sharedworker" and client's global object is a SharedWorkerGlobalObject object, add a BasicClient object that represents client to matchedClients.
    6. +
    7. Else if options.type is "worker" and client's global object is a DedicatedWorkerGlobalObject object, add a Client object that represents client to matchedClients.
    8. +
    9. Else if options.type is "sharedworker" and client's global object is a SharedWorkerGlobalObject object, add a Client object that represents client to matchedClients.
    10. Else if options.type is "all", then:
      1. If client's global object is a Window object, add a WindowClient object that represents client to matchedClients.
      2. -
      3. Else, add a BasicClient object that represents client to matchedClients.
      4. +
      5. Else, add a Client object that represents client to matchedClients.
  4. @@ -941,7 +934,7 @@

    FetchEvent

    [Constructor(DOMString type, optional FetchEventInit eventInitDict), Exposed=ServiceWorker] interface FetchEvent : Event { readonly attribute Request request; - readonly attribute ServiceWorkerClient client; + readonly attribute Client client; readonly attribute boolean isReload; void respondWith((Response or Promise<Response>) r); @@ -951,7 +944,7 @@

    FetchEvent

    dictionary FetchEventInit : EventInit { Request request; - ServiceWorkerClient client; + Client client; boolean isReload; };
    @@ -2404,7 +2397,7 @@

    Handle Fetch

    1. Let activeWorker be registration's active worker.
    2. Run a worker, if not running, for a script with activeWorker's script url and activeWorker's environment settings object.
    3. -
    4. Fire an event named fetch, using FetchEvent interface, with request attribute initialized to r, client attribute initialized to client of the request, in the form of ServiceWorkerClient object, and isReload initialized to true if event was dispatched with the user's intention for the page reload, and false otherwise, at activeWorker's environment settings object's global object.
    5. +
    6. Fire an event named fetch, using FetchEvent interface, with request attribute initialized to r, client attribute initialized to client of the request, in the form of Client object, and isReload initialized to true if event was dispatched with the user's intention for the page reload, and false otherwise, at activeWorker's environment settings object's global object.
    7. For each event listener invoked:
      1. If any uncaught runtime script error occurs, then: