diff --git a/docs/index.bs b/docs/index.bs index 3752da3c..a735f5ba 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -180,7 +180,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

Lifetime

-

The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker object.

+

The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the {{ServiceWorker}} object.

A user agent may terminate service workers at any time it:

@@ -287,8 +287,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 -
-

{{ServiceWorker}}

+
+

{{ServiceWorker}}

       [SecureContext, Exposed=(Window,Worker)]
@@ -311,14 +311,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
       };
     
-

A ServiceWorker object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.

+

A {{ServiceWorker}} object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.

A {{ServiceWorker}} object has an associated {{ServiceWorkerState}} object which is itself associated with service worker's state.

{{ServiceWorker/scriptURL}}

-

The scriptURL attribute must return the service worker's serialized script url.

+

The scriptURL attribute must return the service worker's serialized script url.

For example, consider a document created by a navigation to https://example.com/app.html which matches via the following registration call which has been previously executed:

@@ -335,13 +335,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

{{ServiceWorker/state}}

-

The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

+

The state attribute must return the value (in {{ServiceWorkerState}} enumeration) to which it was last set.

{{ServiceWorker/postMessage(message, transfer)}}

-

The postMessage(message, transfer) method must run these steps:

+

The postMessage(message, transfer) method must run these steps:

  1. If the {{ServiceWorker/state}} attribute value of the context object is "redundant", throw an "{{InvalidStateError}}" exception and abort these steps.
  2. @@ -358,7 +358,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
  3. Create an event e that uses the {{ExtendableMessageEvent}} interface, with the event type message, which does not bubble and is not cancelable.
  4. Let the {{ExtendableMessageEvent/data}} attribute of e be initialized to clonedMessage.
  5. Let the {{ExtendableMessageEvent/origin}} attribute of e be initialized to the Unicode serialization of incumbentSettings's origin.
  6. -
  7. If incumbentGlobal is a {{ServiceWorkerGlobalScope}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{ServiceWorker}} object that represents incumbentGlobal's service worker.
  8. +
  9. If incumbentGlobal is a {{ServiceWorkerGlobalScope}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{ServiceWorker}} object that represents incumbentGlobal's service worker.
  10. Else if incumbentGlobal is a {{Window}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{WindowClient}} object that represents incumbentGlobal's browsing context.
  11. Else, let it be initialized to a new {{Client}} object that represents the worker associated with incumbentGlobal.
  12. Let the {{ExtendableMessageEvent/ports}} attribute of e be initialized to newPorts.
  13. @@ -383,16 +383,16 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - onstatechange - statechange + onstatechange + {{ServiceWorker/statechange}}
-
-

{{ServiceWorkerRegistration}}

+
+

{{ServiceWorkerRegistration}}

       [SecureContext, Exposed=(Window,Worker)]
@@ -411,12 +411,12 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
       };
     
-

A ServiceWorkerRegistration object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.

+

A {{ServiceWorkerRegistration}} object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.

-

installing attribute must return the value to which it was last set.

+

installing attribute must return the value to which it was last set.

The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

@@ -424,7 +424,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
-

waiting attribute must return the value to which it was last set.

+

waiting attribute must return the value to which it was last set.

The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

@@ -432,7 +432,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
-

active attribute must return the value to which it was last set.

+

active attribute must return the value to which it was last set.

The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

@@ -440,7 +440,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

{{ServiceWorkerRegistration/scope}}

-

The scope attribute must return service worker registration's serialized scope url.

+

The scope attribute must return service worker registration's serialized scope url.

In the example in section 3.1.1, the value of registration.scope, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); }) for example, will be "https://example.com/".

@@ -448,14 +448,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

{{ServiceWorkerRegistration/update()}}

-

update() method must run these steps:

+

update() method must run these steps:

  1. Let p be a promise.
  2. -
  3. Let registration be the service worker registration.
  4. +
  5. Let registration be the service worker registration.
  6. Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.
  7. If newestWorker is null, reject p with an "{{InvalidStateError}}" exception and abort these steps.
  8. -
  9. If the context object's relevant settings object's global object globalObject is a {{ServiceWorkerGlobalScope}} object, and globalObject's associated service worker's state is installing, reject p with an "{{InvalidStateError}}" exception and abort these steps.
  10. +
  11. If the context object's relevant settings object's global object globalObject is a {{ServiceWorkerGlobalScope}} object, and globalObject's associated service worker's state is installing, reject p with an "{{InvalidStateError}}" exception and abort these steps.
  12. Let job be the result of running Create Job with update, registration's scope url, newestWorker's script url, p, and the context object's relevant settings object client.
  13. Set job's worker type to newestWorker's type.
  14. Invoke Schedule Job with job.
  15. @@ -468,11 +468,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    The {{ServiceWorkerRegistration/unregister()}} method unregisters the service worker registration. It is important to note that the currently controlled service worker client's active service worker's containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the {{ServiceWorkerRegistration/unregister()}} method only affects subsequent navigations.

    -

    unregister() method must run these steps:

    +

    unregister() method must run these steps:

    1. Let p be a promise.
    2. -
    3. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object's relevant settings object client.
    4. +
    5. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object's relevant settings object client.
    6. Invoke Schedule Job with job.
    7. Return p.
    @@ -481,7 +481,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    Event handler

    -

    The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

    +

    The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing {{ServiceWorkerRegistration}} interface:

    @@ -492,7 +492,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + @@ -501,7 +501,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    - +
           partial interface Navigator {
    @@ -516,8 +516,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
         

    The serviceWorker attribute must return the {{ServiceWorkerContainer}} object that is associated with the context object.

    -
    -

    {{ServiceWorkerContainer}}

    +
    +

    {{ServiceWorkerContainer}}

           [SecureContext, Exposed=(Window,Worker)]
    @@ -547,21 +547,21 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
     
       

    The user agent must create a {{ServiceWorkerContainer}} object when a {{Navigator}} object or a {{WorkerNavigator}} object is created and associate it with that object.

    -

    A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

    +

    A {{ServiceWorkerContainer}} provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

    -

    A {{ServiceWorkerContainer}} has an associated service worker client, which is a service worker client whose global object is associated with the {{Navigator}} object or the {{WorkerNavigator}} object that the {{ServiceWorkerContainer}} is retrieved from.

    +

    A {{ServiceWorkerContainer}} has an associated service worker client, which is a service worker client whose global object is associated with the {{Navigator}} object or the {{WorkerNavigator}} object that the {{ServiceWorkerContainer}} is retrieved from.

    -

    A {{ServiceWorkerContainer}} object has an associated ready promise (a promise). It is initially set to a new promise.

    +

    A {{ServiceWorkerContainer}} object has an associated ready promise (a promise). It is initially set to a new promise.

    A {{ServiceWorkerContainer}} object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a {{ServiceWorkerContainer}} object's client message queue is enabled, the event loop must use it as one of its task sources. When the {{ServiceWorkerContainer}} object's relevant global object is a {{Window}} object, all tasks queued on its client message queue must be associated with its relevant settings object's responsible document.

    -

    controller attribute must run these steps:

    +

    controller attribute must run these steps:

      -
    1. Let client be the context object's service worker client.
    2. +
    3. Let client be the context object's service worker client.
    4. Return the {{ServiceWorker}} object that represents client's active service worker.
    @@ -572,11 +572,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    -

    ready attribute must run these steps:

    +

    ready attribute must run these steps:

      -
    1. If the context object's ready promise is settled, return the context object's ready promise.
    2. -
    3. Let client be the context object's service worker client.
    4. +
    5. If the context object's ready promise is settled, return the context object's ready promise.
    6. +
    7. Let client be the context object's service worker client.
    8. Let registration be null.
    9. Let clientURL be client's creation URL.
    10. Run the following substeps in parallel: @@ -595,13 +595,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    11. If registration's active worker is null, wait until registration's active worker changes.

      Implementers should consider this condition is met when the corresponding registration request gets to the step 6 of Activate algorithm.

    12. -
    13. Resolve context object's ready promise with the {{ServiceWorkerRegistration}} object which represents registration.
    14. +
    15. Resolve context object's ready promise with the {{ServiceWorkerRegistration}} object which represents registration.
    -
  16. Return context object's ready promise.
  17. +
  18. Return context object's ready promise.
  19. -

    When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

    +

    When the {{ServiceWorkerContainer/ready}} attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

    @@ -609,11 +609,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    The {{ServiceWorkerContainer/register(scriptURL, options)}} method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

    -

    register(scriptURL, options) method must run these steps:

    +

    register(scriptURL, options) method must run these steps:

    1. Let p be a promise.
    2. -
    3. Let client be the context object's service worker client.
    4. +
    5. Let client be the context object's service worker client.
    6. Let scriptURL be the result of parsing scriptURL with the context object's relevant settings object's API base URL.
    7. Let scopeURL be null.
    8. If options.{{RegistrationOptions/scope}} is present, set scopeURL to the result of parsing options.{{RegistrationOptions/scope}} with the context object's relevant settings object's API base URL.
    9. @@ -625,10 +625,10 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      -

      getRegistration(clientURL) method must run these steps:

      +

      getRegistration(clientURL) method must run these steps:

        -
      1. Let client be the context object's service worker client.
      2. +
      3. Let client be the context object's service worker client.
      4. Let clientURL be the result of parsing clientURL with the context object's relevant settings object's API base URL.
      5. If clientURL is failure, return a promise rejected with a TypeError.
      6. If the origin of clientURL is not client's origin, return a promise rejected with a "{{SecurityError}}" exception.
      7. @@ -655,10 +655,10 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
        -

        getRegistrations() method must run these steps:

        +

        getRegistrations() method must run these steps:

          -
        1. Let client be the context object's service worker client.
        2. +
        3. Let client be the context object's service worker client.
        4. Let promise be a new promise.
        5. Run the following substeps in parallel:
            @@ -678,13 +678,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
            -

            startMessages() method must enable the context object's client message queue if it is not enabled.

            +

            startMessages() method must enable the context object's client message queue if it is not enabled.

            Event handlers

            -

            The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

            +

            The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the {{ServiceWorkerContainer}} interface:

    onupdatefoundonupdatefound updatefound
    @@ -695,22 +695,22 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - +
    oncontrollerchangeoncontrollerchange controllerchange
    onmessageonmessage message
    -

    The first time the context object's onmessage IDL attribute is set, its client message queue must be enabled.

    +

    The first time the context object's {{ServiceWorkerContainer/onmessage}} IDL attribute is set, its client message queue must be enabled.

-
-

{{ServiceWorkerMessageEvent}}

+
+

{{ServiceWorkerMessageEvent}}

       [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
@@ -732,36 +732,36 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
       };
     
-

Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

+

Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the {{ServiceWorkerMessageEvent}} interface.

{{ServiceWorkerMessageEvent/data|event.data}}

-

The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

+

The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

{{ServiceWorkerMessageEvent/origin|event.origin}}

-

The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.

+

The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.

{{ServiceWorkerMessageEvent/lastEventId|event.lastEventId}}

-

The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

+

The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

{{ServiceWorkerMessageEvent/source|event.source}}

-

The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

+

The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{ServiceWorker}} object whose associated service worker the message is sent from.

{{ServiceWorkerMessageEvent/ports|event.ports}}

-

The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

+

The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

@@ -780,7 +780,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - statechange + statechange {{Event}} The {{ServiceWorker/state}} attribute of the {{ServiceWorker}} object is changed. @@ -801,7 +801,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 updatefound {{Event}} - The service worker registration's installing worker changes. (See step 8 of the Install algorithm.) + The service worker registration's installing worker changes. (See step 8 of the Install algorithm.) @@ -820,7 +820,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 controllerchange {{Event}} - The service worker client's active service worker changes. (See step 9.2 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, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the active worker as the service worker that controls the service worker client.) + The service worker client's active service worker changes. (See step 9.2 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, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the active worker as the service worker that controls the service worker client.) message @@ -874,8 +874,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 -
-

{{ServiceWorkerGlobalScope}}

+
+

{{ServiceWorkerGlobalScope}}

       [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
@@ -897,20 +897,20 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
       };
     
-

A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).

+

A {{ServiceWorkerGlobalScope}} object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).

{{ServiceWorkerGlobalScope}} object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

{{ServiceWorkerGlobalScope/clients}}

-

clients attribute must return the {{Clients}} object that is associated with the context object.

+

clients attribute must return the {{Clients}} object that is associated with the context object.

{{ServiceWorkerGlobalScope/registration}}

-

The registration attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.

+

The registration attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.

@@ -918,7 +918,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

The {{ServiceWorkerGlobalScope/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:

+

skipWaiting() method must run these steps:

  1. Let promise be a new promise.
  2. @@ -940,7 +940,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    Event handlers

    -

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

    +

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the {{ServiceWorkerGlobalScope}} interface:

    @@ -951,23 +951,23 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - + - + - + - + @@ -976,7 +976,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    -

    {{Client}}

    +

    {{Client}}

           [Exposed=ServiceWorker]
    @@ -997,9 +997,9 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

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

    +

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

    -

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

    +

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

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

    @@ -1008,19 +1008,19 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{Client/url}}

    -

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

    +

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

    {{Client/id}}

    -

    The id attribute must return its associated service worker client's id.

    +

    The id attribute must return its associated service worker client's id.

    {{Client/reserved}}

    -

    The reserved attribute must return true if the context object's associated service worker client's execution ready flag is unset, and false otherwise.

    +

    The reserved attribute must return true if the context object's associated service worker client's execution ready flag is unset, and false otherwise.

    Defining the execution ready flag is a work in progress. See the pull request to HTML.

    @@ -1028,11 +1028,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{Client/postMessage(message, transfer)}}

    -

    The postMessage(message, transfer) method must run these steps:

    +

    The postMessage(message, transfer) method must run these steps:

    1. Let sourceSettings be the context object's relevant settings object.
    2. -
    3. Let destination be the {{ServiceWorkerContainer}} object whose service worker client is the context object's service worker client.
    4. +
    5. Let destination be the {{ServiceWorkerContainer}} object whose service worker client is the context object's service worker client.
    6. If destination is null, throw an "{{InvalidStateError}}" exception.
    7. Let targetRealm be destination's relevant Realm.
    8. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
    9. @@ -1043,7 +1043,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    10. Create an event e that uses the {{ServiceWorkerMessageEvent}} interface, with the event type message, which does not bubble and is not cancelable.
    11. Let the {{ServiceWorkerMessageEvent/data}} attribute of e be initialized to clonedMessage.
    12. Let the {{ServiceWorkerMessageEvent/origin}} attribute of e be initialized to the Unicode serialization of sourceSettings's origin.
    13. -
    14. Let the {{ServiceWorkerMessageEvent/source}} attribute of e be initialized to a {{ServiceWorker}} object, which represents the service worker associated with sourceSettings's global object.
    15. +
    16. Let the {{ServiceWorkerMessageEvent/source}} attribute of e be initialized to a {{ServiceWorker}} object, which represents the service worker associated with sourceSettings's global object.
    17. Let the {{ServiceWorkerMessageEvent/ports}} attribute of e be initialized to newPorts.
    18. Dispatch e at destination.
    @@ -1054,36 +1054,36 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{WindowClient/visibilityState}}

    -

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

    +

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

    {{WindowClient/focused}}

    -

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

    +

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

    {{WindowClient/ancestorOrigins}}

    -

    The ancestorOrigins attribute must return the context object's associated service worker client's ancestor origins array.

    +

    The ancestorOrigins attribute must return the context object's associated service worker client's ancestor origins array.

    {{WindowClient/focus()}}

    -

    The focus() method must run these steps:

    +

    The focus() method must run these steps:

    1. If this algorithm is not triggered by user activation, return a promise rejected with an "{{InvalidAccessError}}" exception.
    2. Let promise be a new promise.
    3. Run these substeps in parallel:
        -
      1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
      2. +
      3. Let browsingContext be the context object's associated service worker client's global object's browsing context.
      4. Let visibilityState be null.
      5. Let focusState be false.
      6. Let ancestorOrigins be the empty array.
      7. -
      8. Queue a task 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: +
      9. Queue a task 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. Set visibilityState to browsingContext's active document's {{Document/visibilityState}} attribute value.
        3. @@ -1092,7 +1092,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      10. Wait for task to have executed.
      11. -
      12. Let windowClient be the result of running Create Window Client algorithm with the context object's associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
      13. +
      14. Let windowClient be the result of running Create Window Client algorithm with the context object's associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
      15. If windowClient's focus state is true, resolve promise with windowClient.
      16. Else, reject promise with a TypeError.
      @@ -1104,23 +1104,23 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      {{WindowClient/navigate(url)}}

      -

      The navigate() method must run these steps:

      +

      The navigate() method must run these steps:

      1. Let url be the result of parsing url with the context object's relevant settings object's API base URL.
      2. If url is failure, return a promise rejected with a TypeError.
      3. If url is about:blank, return a promise rejected with a TypeError.
      4. -
      5. If the context object's associated service worker client's active service worker is not the context object's relevant global object's service worker, return a promise rejected with a TypeError.
      6. +
      7. If the context object's associated service worker client's active service worker is not the context object's relevant global object's service worker, return a promise rejected with a TypeError.
      8. Let promise be a new promise.
      9. Run these substeps in parallel:
          -
        1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
        2. +
        3. Let browsingContext be the context object's associated service worker client's global object's browsing context.
        4. If browsingContext has discarded its {{Document}}, reject promise with a TypeError and abort these steps.
        5. Let navigateFailed to false.
        6. Let visibilityState be null.
        7. Let focusState be false.
        8. Let ancestorOrigins be the empty array.
        9. -
        10. Queue a task 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: +
        11. Queue a task 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. HandleNavigate: Navigate browsingContext to url with exceptions enabled. The source browsing context must be browsingContext.
          2. If the algorithm steps invoked in the step labeled HandleNavigate throws an exception, set navigateFailed to true.
          3. @@ -1131,7 +1131,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
          4. Wait for task to have executed (including its asynchronous steps).
          5. If navigateFailed is true, reject promise with a TypeError and abort these steps.
          6. -
          7. If browsingContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then: +
          8. If browsingContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then:
            1. Resolve promise with null.
            2. Abort these steps.
            3. @@ -1146,8 +1146,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    -
    -

    {{Clients}}

    +
    +

    {{Clients}}

           [Exposed=ServiceWorker]
    @@ -1175,18 +1175,18 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

    +

    The user agent must create a {{Clients}} object when a {{ServiceWorkerGlobalScope}} object is created and associate it with that object.

    {{Clients/get(id)}}

    -

    The get(id) method must run these steps:

    +

    The get(id) method must run these steps:

    1. Let promise be a new promise.
    2. Run these substeps in parallel:
        -
      1. For each service worker client client whose origin is the same as the associated service worker's origin: +
      2. For each service worker client client whose origin is the same as the associated service worker's origin:
        1. If client's id is not id, continue to the next iteration of the loop.
        2. If client is a type of environment, then: @@ -1237,14 +1237,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

          {{Clients/matchAll(options)}}

          -

          The matchAll(options) method must run these steps:

          +

          The matchAll(options) method must run these steps:

          1. Let promise be a new promise.
          2. Run these substeps in parallel:
            1. Let targetClients be an empty array.
            2. -
            3. For each service worker client client whose origin is the same as the associated service worker's origin: +
            4. For each service worker client client whose origin is the same as the associated service worker's origin:
              1. If client is a type of environment, then:
                  @@ -1258,7 +1258,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                1. If options.{{ClientQueryOptions/includeUncontrolled}} is false, then:
                    -
                  1. If client's active service worker is not the associated service worker, continue to the next iteration of the loop.
                  2. +
                  3. If client's active service worker is not the associated service worker, continue to the next iteration of the loop.
                2. If options.{{ClientQueryOptions/includeReserved}} is false, then: @@ -1319,7 +1319,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                  {{Clients/openWindow(url)}}

                  -

                  The openWindow(url) method must run these steps:

                  +

                  The openWindow(url) method must run these steps:

                  1. Let url be the result of parsing url with the context object's relevant settings object's API base URL.
                  2. @@ -1345,7 +1345,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                  3. Wait for task to have executed (including its asynchronous steps).
                  4. If openWindowFailed is true, reject promise with a TypeError and abort these steps.
                  5. -
                  6. If newContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then: +
                  7. If newContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then:
                    1. Resolve promise with null.
                    2. Abort these steps.
                    3. @@ -1362,14 +1362,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                      {{Clients/claim()}}

                      -

                      The claim() method must run these steps:

                      +

                      The claim() method must run these steps:

                        -
                      1. If the service worker is not an active worker, return a promise rejected with an "{{InvalidStateError}}" exception.
                      2. +
                      3. If the service worker is not an active worker, return a promise rejected with an "{{InvalidStateError}}" exception.
                      4. Let promise be a new promise.
                      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: +
                        2. For each service worker client client whose origin is the same as the service worker's origin:
                          1. If client is a type of environment, then:
                              @@ -1382,11 +1382,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          2. Let registration be the result of running Match Service Worker Registration algorithm passing client's creation URL as the argument.
                          3. -
                          4. If registration is not the service worker's containing service worker registration, continue to the next iteration of the loop.
                          5. -
                          6. If client's active service worker is not the service worker, then: +
                          7. If registration is not the service worker's containing service worker registration, continue to the next iteration of the loop.
                          8. +
                          9. If client's active service worker is not the service worker, then:
                            1. Invoke Handle Service Worker Client Unload with client as the argument.
                            2. -
                            3. Set client's active service worker to service worker.
                            4. +
                            5. Set client's active service worker to service worker.
                            6. Invoke Notify Controller Change algorithm with client as the argument.
                          10. @@ -1401,7 +1401,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                      -

                      {{ExtendableEvent}}

                      +

                      {{ExtendableEvent}}

                             [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
                      @@ -1415,7 +1415,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                             };
                           
                      -

                      An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

                      +

                      An {{ExtendableEvent}} object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

                      An {{ExtendableEvent}} object has an associated extensions allowed flag. It is initially set.

                      @@ -1445,7 +1445,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                      {{ExtendableEvent/waitUntil(f)}} method extends the lifetime of the event.

                      -

                      waitUntil(f) method must run these steps:

                      +

                      waitUntil(f) method must run these steps:

                      1. If the extensions allowed flag is unset, then: @@ -1454,11 +1454,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                      2. Abort these steps.
                      -
                    4. Add f to the extend lifetime promises.
                    5. +
                    6. Add f to the extend lifetime promises.
                  -

                  Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

                  +

                  Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

                  Service workers define the following behaviors for install event and activate event, respectively:

                  @@ -1468,8 +1468,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
          -
          -

          {{InstallEvent}}

          +
          +

          {{InstallEvent}}

                 [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
          @@ -1488,7 +1488,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           
                 

          {{InstallEvent/registerForeignFetch(options)}} registers this service worker to handle foreign fetches from certain origins for certain sub scopes.

          -

          registerForeignFetch(options) method must run these steps:

          +

          registerForeignFetch(options) method must run these steps:

          1. If the dispatch flag is unset, then:
              @@ -1526,8 +1526,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
          -
          -

          {{FetchEvent}}

          +
          +

          {{FetchEvent}}

                 [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
          @@ -1551,44 +1551,44 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                 };
               
          -

          Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the {{ExtendableEvent}} interface.

          +

          Service workers have an essential functional event fetch. For fetch event, service workers use the {{FetchEvent}} interface which extends the {{ExtendableEvent}} interface.

          -

          Each event using {{FetchEvent}} interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset: +

          Each event using {{FetchEvent}} interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

            -
          • wait to respond flag
          • -
          • respond-with entered flag
          • -
          • respond-with error flag
          • +
          • wait to respond flag
          • +
          • respond-with entered flag
          • +
          • respond-with error flag

          {{FetchEvent/request|event.request}}

          -

          request attribute must return the value it was initialized to.

          +

          request attribute must return the value it was initialized to.

          {{FetchEvent/clientId|event.clientId}}

          -

          clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          +

          clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          {{FetchEvent/reservedClientId|event.reservedClientId}}

          -

          reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          +

          reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          {{FetchEvent/targetClientId|event.targetClientId}}

          -

          targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          +

          targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

          {{FetchEvent/isReload|event.isReload}}

          -

          isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

          +

          isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

          Pressing the refresh button should be considered a reload while clicking a link and pressing the back button should not. The behavior of the Ctrl+l enter is left to the implementations of the user agents.

          @@ -1598,7 +1598,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

          Developers can set the argument r with either a promise that resolves with a {{Response}} object or a {{Response}} object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.

          -

          respondWith(r) method must run these steps:

          +

          respondWith(r) method must run these steps:

          1. If the dispatch flag is unset, then: @@ -1607,7 +1607,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
          2. Abort these steps.
        3. -
        4. If the respond-with entered flag is set, then: +
        5. If the respond-with entered flag is set, then:
          1. Throw an "{{InvalidStateError}}" exception.
          2. Abort these steps.
          3. @@ -1617,15 +1617,15 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

            {{FetchEvent/respondWith(r)|event.respondWith(r)}} extends the lifetime of the event by default as if {{ExtendableEvent/waitUntil(f)|event.waitUntil(r)}} is called.

          4. Set the stop propagation flag and stop immediate propagation flag.
          5. -
          6. Set the respond-with entered flag.
          7. -
          8. Set the wait to respond flag.
          9. +
          10. Set the respond-with entered flag.
          11. +
          12. Set the wait to respond flag.
          13. Let targetRealm be the relevant Realm of the context object.
          14. Run the following substeps in parallel:
            1. Wait until r settles.
            2. If r rejected, then:
                -
              1. Set the respond-with error flag.
              2. +
              3. Set the respond-with error flag.
            3. If r resolved with response, then: @@ -1634,7 +1634,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
              1. If response is disturbed or locked, then:
                  -
                1. Set the respond-with error flag.
                2. +
                3. Set the respond-with error flag.
              2. Else: @@ -1675,28 +1675,28 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

              These substeps are meant to produce the observable equivalent of "piping" response's body's stream into potentialResponse.

            4. -
            5. Set the potential response to potentialResponse.
            6. +
            7. Set the potential response to potentialResponse.
        6. Else:
            -
          1. Set the respond-with error flag.
          2. +
          3. Set the respond-with error flag.
          -

          If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)

          +

          If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)

      3. -
      4. Unset the wait to respond flag.
      5. +
      6. Unset the wait to respond flag.
    -
    -

    {{ForeignFetchEvent}}

    +
    +

    {{ForeignFetchEvent}}

           [Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker]
    @@ -1719,26 +1719,26 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    Service workers have a functional event foreignfetch. For foreignfetch events, service workers use the ForeignFetchEvent interface which extends the {{ExtendableEvent}} interface.

    +

    Service workers have a functional event foreignfetch. For foreignfetch events, service workers use the {{ForeignFetchEvent}} interface which extends the {{ExtendableEvent}} interface.

    -

    Each event using {{ForeignFetchEvent}} interface has an associated potential response (a response), initially set to null, an associated origin (a {{USVString}} or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset: +

    Each event using {{ForeignFetchEvent}} interface has an associated potential response (a response), initially set to null, an associated origin (a {{USVString}} or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset:

      -
    • wait to respond flag
    • -
    • respond-with entered flag
    • -
    • respond-with error flag
    • +
    • wait to respond flag
    • +
    • respond-with entered flag
    • +
    • respond-with error flag

    {{ForeignFetchEvent/request|event.request}}

    -

    The request attribute must return the value it was initialized to.

    +

    The request attribute must return the value it was initialized to.

    {{ForeignFetchEvent/origin|event.origin}}

    -

    The origin attribute must return the value it was initialized to.

    +

    The origin attribute must return the value it was initialized to.

    @@ -1746,7 +1746,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    Developers can set the argument r with either a promise that resolves with a {{Response}} object or a {{Response}} object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.

    -

    respondWith(r) method must run these steps:

    +

    respondWith(r) method must run these steps:

    1. If the dispatch flag is unset, then: @@ -1755,7 +1755,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    2. Abort these steps.
    -
  3. If the respond-with entered flag is set, then: +
  4. If the respond-with entered flag is set, then:
    1. Throw an "{{InvalidStateError}}" exception.
    2. Abort these steps.
    3. @@ -1763,15 +1763,15 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    4. Add r to the extend lifetime promises.
    5. Set the stop propagation flag and stop immediate propagation flag.
    6. -
    7. Set the respond-with entered flag.
    8. -
    9. Set the wait to respond flag.
    10. +
    11. Set the respond-with entered flag.
    12. +
    13. Set the wait to respond flag.
    14. Let targetRealm be the relevant Realm of the context object.
    15. Run the following substeps in parallel:
      1. Wait until r settles.
      2. If r rejected, then:
          -
        1. Set the respond-with error flag.
        2. +
        3. Set the respond-with error flag.
      3. If r resolved with response, then: @@ -1782,7 +1782,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      4. Set the list of exposed headers to response.{{ForeignFetchResponse/headers}}.
      5. If response.{{ForeignFetchResponse/response}} is disturbed or locked, then:
          -
        1. Set the respond-with error flag.
        2. +
        3. Set the respond-with error flag.
      6. Else: @@ -1822,28 +1822,28 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    16. -
    17. Set the potential response to potentialResponse.
    18. +
    19. Set the potential response to potentialResponse.
  5. Else:
      -
    1. Set the respond-with error flag.
    2. +
    3. Set the respond-with error flag.
    -

    If the respond-with error flag is set, a network error is returned to Fetch through [[#on-foreign-fetch-request-algorithm]] algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through [[#on-foreign-fetch-request-algorithm]] algorithm. (See the step 20.1.)

    +

    If the respond-with error flag is set, a network error is returned to Fetch through [[#on-foreign-fetch-request-algorithm]] algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through [[#on-foreign-fetch-request-algorithm]] algorithm. (See the step 20.1.)

  6. -
  7. Unset the wait to respond flag.
  8. +
  9. Unset the wait to respond flag.
  10. -
    -

    {{ExtendableMessageEvent}}

    +
    +

    {{ExtendableMessageEvent}}

           [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
    @@ -1865,43 +1865,43 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    Service workers define the extendable message event that extends the {{Window/message}} event defined in [[!HTML]] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the {{ExtendableEvent}} interface.

    +

    Service workers define the extendable message event that extends the {{Window/message}} event defined in [[!HTML]] to allow extending the lifetime of the event. For the message event, service workers use the {{ExtendableMessageEvent}} interface which extends the {{ExtendableEvent}} interface.

    {{ExtendableMessageEvent/data|event.data}}

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    {{ExtendableMessageEvent/origin|event.origin}}

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    {{ExtendableMessageEvent/lastEventId|event.lastEventId}}

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    {{ExtendableMessageEvent/source|event.source}}

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{Client}} object from which the message is sent.

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{Client}} object from which the message is sent.

    {{ExtendableMessageEvent/ports|event.ports}}

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

    Events

    -

    The following events are dispatched on ServiceWorkerGlobalScope object:

    +

    The following events are dispatched on {{ServiceWorkerGlobalScope}} object:

    oninstalloninstall install
    onactivateonactivate activate
    onfetchonfetch fetch
    onforeignfetchonforeignfetch foreignfetch
    onmessageonmessage message
    @@ -1915,17 +1915,17 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - + - + @@ -2006,7 +2006,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    - +
           partial interface HTMLLinkElement {
    @@ -2060,8 +2060,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
         
    -
    -

    {{Cache}}

    +
    +

    {{Cache}}

           [SecureContext, Exposed=(Window,Worker)]
    @@ -2092,14 +2092,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    A Cache object represents a request to response map. Multiple separate objects implementing the {{Cache}} interface across documents and workers can all be associated with the same request to response map simultaneously.

    +

    A {{Cache}} object represents a request to response map. Multiple separate objects implementing the {{Cache}} interface across documents and workers can all be associated with the same request to response map simultaneously.

    {{Cache}} objects are always enumerable via {{WindowOrWorkerGlobalScope/caches|self.caches}} in insertion order (per ECMAScript 6 Map objects).

    {{Cache/match(request, options)}}

    -

    match(request, options) method must run these steps:

    +

    match(request, options) method must run these steps:

    1. Let promise be a new promise.
    2. @@ -2135,7 +2135,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      {{Cache/matchAll(request, options)}}

      -

      matchAll(request, options) method must run these steps:

      +

      matchAll(request, options) method must run these steps:

      1. Let r be null.
      2. @@ -2192,7 +2192,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

        {{Cache/add(request)}}

        -

        add(request) method must run these steps:

        +

        add(request) method must run these steps:

        1. Let requests be an array containing only request.
        2. @@ -2204,7 +2204,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

          {{Cache/addAll(requests)}}

          -

          addAll(requests) method must run these steps:

          +

          addAll(requests) method must run these steps:

          1. Let responsePromiseArray be an empty array.
          2. @@ -2324,7 +2324,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

            {{Cache/put(request, response)}}

            -

            put(request, response) method must run these steps:

            +

            put(request, response) method must run these steps:

            1. Let r be null.
            2. @@ -2405,7 +2405,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

              {{Cache/delete(request, options)}}

              -

              delete(request, options) method must run these steps:

              +

              delete(request, options) method must run these steps:

              1. Let r be null.
              2. @@ -2439,7 +2439,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                {{Cache/keys(request, options)}}

                -

                keys(request, options) method must run these steps:

                +

                keys(request, options) method must run these steps:

                1. Let promise be a new promise.
                2. @@ -2485,8 +2485,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
              -
              -

              {{CacheStorage}}

              +
              +

              {{CacheStorage}}

                     [SecureContext, Exposed=(Window,Worker)]
              @@ -2504,12 +2504,12 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
               
                   

              The user agent must create a {{CacheStorage}} object when a {{Window}} object or a {{WorkerGlobalScope}} object is created and associate it with that global object.

              -

              A CacheStorage object represents a name to cache map of its associated global object's environment settings object's origin. Multiple separate objects implementing the {{CacheStorage}} interface across documents and workers can all be associated with the same name to cache map simultaneously.

              +

              A {{CacheStorage}} object represents a name to cache map of its associated global object's environment settings object's origin. Multiple separate objects implementing the {{CacheStorage}} interface across documents and workers can all be associated with the same name to cache map simultaneously.

              {{CacheStorage/match(request, options)}}

              -

              match(request, options) method must run these steps:

              +

              match(request, options) method must run these steps:

              1. If options.{{CacheQueryOptions/cacheName}} is present, then: @@ -2553,7 +2553,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                {{CacheStorage/has(cacheName)}}

                -

                has(cacheName) method must run these steps:

                +

                has(cacheName) method must run these steps:

                1. Return a promise p resolved with the result of running the following substeps: @@ -2576,7 +2576,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                  {{CacheStorage/open(cacheName)}}

                  -

                  open(cacheName) method must run these steps:

                  +

                  open(cacheName) method must run these steps:

                  1. Let p be a new promise.
                  2. @@ -2604,7 +2604,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                    {{CacheStorage/delete(cacheName)}}

                    -

                    delete(cacheName) method must run these steps:

                    +

                    delete(cacheName) method must run these steps:

                    1. Let p be the result of running the algorithm specified in {{CacheStorage/has(cacheName)}} method with cacheName as the argument.
                    2. @@ -2631,7 +2631,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                      {{CacheStorage/keys()}}

                      -

                      keys() method must run these steps:

                      +

                      keys() method must run these steps:

                      The promise returned from this method resolves with the sequence of keys, cache names in DOMString, in insertion order.

                      @@ -2690,7 +2690,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                      When the importScripts(urls) method is called on a {{ServiceWorkerGlobalScope}} object, the user agent must import scripts into worker global scope, given this {{ServiceWorkerGlobalScope}} object and urls, and with the following steps to perform the fetch given the request request:

                        -
                      1. Let serviceWorker be request's client's global object's service worker.
                      2. +
                      3. Let serviceWorker be request's client's global object's service worker.
                      4. If serviceWorker's imported scripts updated flag is unset, then:
                        1. Let response be the result of fetching request.
                        2. @@ -3382,7 +3382,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                        3. If script's has ever been evaluated flag is unset, then:
                            -
                          1. Set workerGlobalScope's associated service worker's set of event types to handle to the set of event types created from settingsObject's global object's associated list of event listeners' event types. +
                          2. Set workerGlobalScope's associated service worker's set of event types to handle to the set of event types created from settingsObject's global object's associated list of event listeners' event types.

                            If the global object's associated list of event listeners does not have any event listener added at this moment, the service worker's set of event types to handle is set to an empty set. The user agents are encouraged to show a warning that the event listeners must be added on the very first evaluation of the worker script.

                          3. Set script's has ever been evaluated flag.
                          4. @@ -3476,18 +3476,18 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          5. Queue a task task to run the following substeps:
                            1. Create a trusted event e that uses the {{FetchEvent}} interface, with the event type fetch, which does not bubble.
                            2. -
                            3. Let the request attribute of e be initialized to r.
                            4. +
                            5. Let the {{FetchEvent/request}} attribute of e be initialized to r.
                            6. Initialize e's {{FetchEvent/clientId}} attribute to client's id.
                            7. If request is a non-subresource request and request's destination is not "report", initialize e's {{FetchEvent/reservedClientId}} attribute to reservedClient's id, and to the empty string otherwise.
                            8. If request is a navigation request, initialize e's {{FetchEvent/targetClientId}} attribute to request's target client id, and to the empty string otherwise.
                            9. -
                            10. Let the isReload attribute of e be initialized to true if request's client is a window client and the event was dispatched with the user's intention for the page reload, and false otherwise.
                            11. +
                            12. Let the {{FetchEvent/isReload}} attribute of e be initialized to true if request's client is a window client and the event was dispatched with the user's intention for the page reload, and false otherwise.
                            13. Dispatch e at activeWorker's environment settings object's global object.
                            14. -
                            15. If e's respond-with entered flag is set, set respondWithEntered to true.
                            16. -
                            17. If e's wait to respond flag is set, then: +
                            18. If e's respond-with entered flag is set, set respondWithEntered to true.
                            19. +
                            20. If e's wait to respond flag is set, then:
                                -
                              1. Wait until e's wait to respond flag is unset.
                              2. -
                              3. If e's respond-with error flag is set, set handleFetchFailed to true.
                              4. -
                              5. Else, set response to e's potential response.
                              6. +
                              7. Wait until e's wait to respond flag is unset.
                              8. +
                              9. If e's respond-with error flag is set, set handleFetchFailed to true.
                              10. +
                              11. Else, set response to e's potential response.
                            21. If e's canceled flag is set, set eventCanceled to true.
                            22. @@ -3562,20 +3562,20 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                            23. Let the {{ForeignFetchEvent/request}} attribute of e be initialized to r.
                            24. Let the {{ForeignFetchEvent/origin}} attribute of e be initialized to the Unicode serialization of request's origin.
                            25. Dispatch e at activeWorker's environment settings object's global object.
                            26. -
                            27. If e's respond-with entered flag is set, set respondWithEntered to true.
                            28. +
                            29. If e's respond-with entered flag is set, set respondWithEntered to true.
                            30. If e's wait to respond flag is set, wait until e's wait to respond flag is unset.
                            31. -
                            32. Let internalResponse be e's potential response.
                            33. +
                            34. Let internalResponse be e's potential response.
                            35. If internalResponse is a filtered response, set internalResponse to internalResponse's internal response.
                            36. If e's respond-with error flag is set, set handleFetchFailed to true.
                            37. Else if e's origin is null:
                              1. If e's list of exposed headers is not empty, set handleFetchFailed to true.
                              2. -
                              3. Else if e's potential response is a opaque-redirect filtered response, set response to e's potential response.
                              4. +
                              5. Else if e's potential response is a opaque-redirect filtered response, set response to e's potential response.
                              6. Else set response to an opaque filtered response of internalResponse.
                            38. Else if e's origin is not equal to the Unicode serialization of request's origin, set handleFetchFailed to true.
                            39. -
                            40. Else if e's potential response is an opaque filtered response or is an opaque-redirect filtered response, set response to e's potential response.
                            41. +
                            42. Else if e's potential response is an opaque filtered response or is an opaque-redirect filtered response, set response to e's potential response.
                            43. Else if request's response tainting is "opaque", set response to an opaque filtered response of internalResponse.
                            44. Else:
                                @@ -3623,7 +3623,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                Input
                                -
                                registration, a service worker registration
                                +
                                registration, a service worker registration
                                callbackSteps, an algorithm
                                Output
                                None
                                @@ -3806,7 +3806,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                              1. Set registration's installing worker to source.
                              2. For each registrationObject in registrationObjects:
                                  -
                                1. Queue a task to set the installing attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s installing worker, or null if registration’s installing worker is null.
                                2. +
                                3. Queue a task to set the {{ServiceWorkerRegistration/installing}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s installing worker, or null if registration’s installing worker is null.
                              @@ -3816,7 +3816,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                            45. Set registration's waiting worker to source.
                            46. For each registrationObject in registrationObjects:
                                -
                              1. Queue a task to set the waiting attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s waiting worker, or null if registration’s waiting worker is null.
                              2. +
                              3. Queue a task to set the {{ServiceWorkerRegistration/waiting}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s waiting worker, or null if registration’s waiting worker is null.
                            @@ -3826,7 +3826,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          6. Set registration's active worker to source.
                          7. For each registrationObject in registrationObjects:
                              -
                            1. Queue a task to set the active attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s active worker, or null if registration’s active worker is null.
                            2. +
                            3. Queue a task to set the {{ServiceWorkerRegistration/active}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s active worker, or null if registration’s active worker is null.
                          @@ -3847,16 +3847,16 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          1. Set worker's state to state.
                          2. -
                          3. Let workerObjects be an array containing all the ServiceWorker objects associated with worker.
                          4. +
                          5. Let workerObjects be an array containing all the {{ServiceWorker}} objects associated with worker.
                          6. For each workerObject in workerObjects:
                            1. Queue a task to run these substeps:
                                -
                              1. Set the state attribute of workerObject to the value (in {{ServiceWorkerState}} enumeration) corresponding to the first matching statement, switching on worker's state: +
                              2. Set the {{ServiceWorker/state}} attribute of workerObject to the value (in {{ServiceWorkerState}} enumeration) corresponding to the first matching statement, switching on worker's state:
                                installing
                                "installing" -

                                The service worker in this state is considered an installing worker. During this state, event.waitUntil(f) can be called inside the oninstall event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.

                                +

                                The service worker in this state is considered an installing worker. During this state, event.waitUntil(f) can be called inside the {{ServiceWorkerGlobalScope/oninstall}} event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.

                                installed
                                "installed" @@ -3864,7 +3864,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                activating
                                "activating" -

                                The service worker in this state is considered an active worker. During this state, event.waitUntil(f) can be called inside the onactivate event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.

                                +

                                The service worker in this state is considered an active worker. During this state, event.waitUntil(f) can be called inside the {{ServiceWorkerGlobalScope/onactivate}} event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.

                                activated
                                "activated" @@ -3895,7 +3895,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                1. Assert: client is not null.
                                2. -
                                3. If client is a type of environment settings object, queue a task to fire an event named controllerchange at the ServiceWorkerContainer object client is associated with.
                                4. +
                                5. If client is a type of environment settings object, queue a task to fire an event named controllerchange at the {{ServiceWorkerContainer}} object client is associated with.

                                The task must use client's responsible event loop and the DOM manipulation task source.

                      @@ -4003,7 +4003,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                      1. Let clientObject be a new {{Client}} object.
                      2. -
                      3. Set clientObject's service worker client to client.
                      4. +
                      5. Set clientObject's service worker client to client.
                      6. Return clientObject.
                    @@ -4022,7 +4022,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                    1. Let windowClient be a new {{WindowClient}} object.
                    2. -
                    3. Set windowClient's service worker client to client.
                    4. +
                    5. Set windowClient's service worker client to client.
                    6. Set windowClient's visibility state to visibilityState.
                    7. Set windowClient's focus state to focusState.
                    8. Set windowClient's ancestor origins array to ancestorOrigins.
                    9. diff --git a/docs/index.html b/docs/index.html index 6edcb697..0a8f9964 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1422,7 +1422,7 @@

                      Service Workers Nightly

                      -

                      Editor’s Draft,

                      +

                      Editor’s Draft,

                      This version: @@ -1496,7 +1496,7 @@

                      Table of Contents

                      3 Client Context
                      1. - 3.1 ServiceWorker + 3.1 ServiceWorker
                        1. 3.1.1 scriptURL
                        2. 3.1.2 state @@ -1504,7 +1504,7 @@

                          Table of Contents

                        3. 3.1.4 Event handler
                      2. - 3.2 ServiceWorkerRegistration + 3.2 ServiceWorkerRegistration
                        1. 3.2.1 installing
                        2. 3.2.2 waiting @@ -1514,9 +1514,9 @@

                          Table of Contents

                        3. 3.2.6 unregister()
                        4. 3.2.7 Event handler
                        -
                      3. 3.3 navigator.serviceWorker +
                      4. 3.3 navigator.serviceWorker
                      5. - 3.4 ServiceWorkerContainer + 3.4 ServiceWorkerContainer
                        1. 3.4.1 controller
                        2. 3.4.2 ready @@ -1527,7 +1527,7 @@

                          Table of Contents

                        3. 3.4.7 Event handlers
                      6. - 3.5 ServiceWorkerMessageEvent + 3.5 ServiceWorkerMessageEvent
                        1. 3.5.1 event.data
                        2. 3.5.2 event.origin @@ -1541,7 +1541,7 @@

                          Table of Contents

                          4 Execution Context
                          1. - 4.1 ServiceWorkerGlobalScope + 4.1 ServiceWorkerGlobalScope
                            1. 4.1.1 clients
                            2. 4.1.2 registration @@ -1549,7 +1549,7 @@

                              Table of Contents

                            3. 4.1.4 Event handlers
                          2. - 4.2 Client + 4.2 Client
                            1. 4.2.1 url
                            2. 4.2.2 id @@ -1562,7 +1562,7 @@

                              Table of Contents

                            3. 4.2.9 navigate(url)
                          3. - 4.3 Clients + 4.3 Clients
                            1. 4.3.1 get(id)
                            2. 4.3.2 matchAll(options) @@ -1570,17 +1570,17 @@

                              Table of Contents

                            3. 4.3.4 claim()
                          4. - 4.4 ExtendableEvent + 4.4 ExtendableEvent
                            1. 4.4.1 event.waitUntil(f)
                          5. - 4.5 InstallEvent + 4.5 InstallEvent
                            1. 4.5.1 event.registerForeignFetch(options)
                          6. - 4.6 FetchEvent + 4.6 FetchEvent
                            1. 4.6.1 event.request
                            2. 4.6.2 event.clientId @@ -1590,14 +1590,14 @@

                              Table of Contents

                            3. 4.6.6 event.respondWith(r)
                          7. - 4.7 ForeignFetchEvent + 4.7 ForeignFetchEvent
                            1. 4.7.1 event.request
                            2. 4.7.2 event.origin
                            3. 4.7.3 event.respondWith(r)
                          8. - 4.8 ExtendableMessageEvent + 4.8 ExtendableMessageEvent
                            1. 4.8.1 event.data
                            2. 4.8.2 event.origin @@ -1611,7 +1611,7 @@

                              Table of Contents

                              5 Link type "serviceworker"
                              1. 5.1 Processing -
                              2. 5.2 Link element interface extensions +
                              3. 5.2 Link element interface extensions
                            3. 6 Caches @@ -1624,7 +1624,7 @@

                              Table of Contents

                            4. 6.3.1 caches
                          9. - 6.4 Cache + 6.4 Cache
                            1. 6.4.1 match(request, options)
                            2. 6.4.2 matchAll(request, options) @@ -1635,7 +1635,7 @@

                              Table of Contents

                            3. 6.4.7 keys(request, options)
                          10. - 6.5 CacheStorage + 6.5 CacheStorage
                            1. 6.5.1 match(request, options)
                            2. 6.5.2 has(cacheName) @@ -1766,7 +1766,7 @@

                              A service worker has an associated list of foreign fetch origins whose element type is a URL. It is initially empty.

                              2.1.1. Lifetime

                              -

                              The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker object.

                              +

                              The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker object.

                              A user agent may terminate service workers at any time it:

                              @@ -1848,19 +1848,19 @@

                              3.1. ServiceWorker

                              +

                              3.1. ServiceWorker

                              [SecureContext, Exposed=(Window,Worker)]
                              -interface ServiceWorker : EventTarget {
                              -  readonly attribute USVString scriptURL;
                              -  readonly attribute ServiceWorkerState state;
                              -  void postMessage(any message, optional sequence<object> transfer = []);
                              +interface ServiceWorker : EventTarget {
                              +  readonly attribute USVString scriptURL;
                              +  readonly attribute ServiceWorkerState state;
                              +  void postMessage(any message, optional sequence<object> transfer = []);
                               
                                 // event
                              -  attribute EventHandler onstatechange;
                              +  attribute EventHandler onstatechange;
                               };
                              -ServiceWorker implements AbstractWorker;
                              +ServiceWorker implements AbstractWorker;
                               
                              -enum ServiceWorkerState {
                              +enum ServiceWorkerState {
                                 "installing",
                                 "installed",
                                 "activating",
                              @@ -1868,11 +1868,11 @@ 

                              "redundant" };

                              -

                              A ServiceWorker object represents a service worker. Each ServiceWorker object is associated with a service worker. Multiple separate objects implementing the ServiceWorker interface across documents and workers can all be associated with the same service worker simultaneously.

                              -

                              A ServiceWorker object has an associated ServiceWorkerState object which is itself associated with service worker’s state.

                              +

                              A ServiceWorker object represents a service worker. Each ServiceWorker object is associated with a service worker. Multiple separate objects implementing the ServiceWorker interface across documents and workers can all be associated with the same service worker simultaneously.

                              +

                              A ServiceWorker object has an associated ServiceWorkerState object which is itself associated with service worker’s state.

                              -

                              3.1.1. scriptURL

                              -

                              The scriptURL attribute must return the service worker’s serialized script url.

                              +

                              3.1.1. scriptURL

                              +

                              The scriptURL attribute must return the service worker’s serialized script url.

                              For example, consider a document created by a navigation to https://example.com/app.html which matches via the following registration call which has been previously executed:

                              @@ -1883,17 +1883,17 @@

                              -

                              3.1.2. state

                              -

                              The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

                              +

                              3.1.2. state

                              +

                              The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

                              -

                              3.1.3. postMessage(message, transfer)

                              -

                              The postMessage(message, transfer) method must run these steps:

                              +

                              3.1.3. postMessage(message, transfer)

                              +

                              The postMessage(message, transfer) method must run these steps:

                                -
                              1. If the state attribute value of the context object is "redundant", throw an "InvalidStateError" exception and abort these steps. +
                              2. If the state attribute value of the context object is "redundant", throw an "InvalidStateError" exception and abort these steps.
                              3. Let serviceWorker be the service worker represented by the context object.
                              4. Invoke Run Service Worker algorithm with serviceWorker as the argument. -
                              5. Let destination be the ServiceWorkerGlobalScope object associated with serviceWorker. +
                              6. Let destination be the ServiceWorkerGlobalScope object associated with serviceWorker.
                              7. Let targetRealm be destination’s Realm.
                              8. Let incumbentSettings be the incumbent settings object, and incumbentGlobal its global object.
                              9. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. @@ -1902,13 +1902,13 @@

                                <
                              10. Queue a task that runs the following steps:
                                  -
                                1. Create an event e that uses the ExtendableMessageEvent interface, with the event type message, which does not bubble and is not cancelable. -
                                2. Let the data attribute of e be initialized to clonedMessage. -
                                3. Let the origin attribute of e be initialized to the Unicode serialization of incumbentSettings’s origin. -
                                4. If incumbentGlobal is a ServiceWorkerGlobalScope object, let the source attribute of e be initialized to a new ServiceWorker object that represents incumbentGlobal’s service worker. -
                                5. Else if incumbentGlobal is a Window object, let the source attribute of e be initialized to a new WindowClient object that represents incumbentGlobal’s browsing context. -
                                6. Else, let it be initialized to a new Client object that represents the worker associated with incumbentGlobal. -
                                7. Let the ports attribute of e be initialized to newPorts. +
                                8. Create an event e that uses the ExtendableMessageEvent interface, with the event type message, which does not bubble and is not cancelable. +
                                9. Let the data attribute of e be initialized to clonedMessage. +
                                10. Let the origin attribute of e be initialized to the Unicode serialization of incumbentSettings’s origin. +
                                11. If incumbentGlobal is a ServiceWorkerGlobalScope object, let the source attribute of e be initialized to a new ServiceWorker object that represents incumbentGlobal’s service worker. +
                                12. Else if incumbentGlobal is a Window object, let the source attribute of e be initialized to a new WindowClient object that represents incumbentGlobal’s browsing context. +
                                13. Else, let it be initialized to a new Client object that represents the worker associated with incumbentGlobal. +
                                14. Let the ports attribute of e be initialized to newPorts.
                                15. Dispatch e at destination.

                                The task must use the DOM manipulation task source.

                                @@ -1916,7 +1916,7 @@

                                <

                              3.1.4. Event handler

                              -

                              The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorker interface:

                              +

                              The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorker interface:

    install {{InstallEvent}}[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.)[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.)
    activate {{ExtendableEvent}}[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.)[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.)
    fetch {{FetchEvent}}[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)
    foreignfetch
    @@ -1924,58 +1924,58 @@

    event handler event type

    -
    onstatechange - statechange + onstatechange + statechange
-

3.2. ServiceWorkerRegistration

+

3.2. ServiceWorkerRegistration

[SecureContext, Exposed=(Window,Worker)]
-interface ServiceWorkerRegistration : EventTarget {
-  readonly attribute ServiceWorker? installing;
-  readonly attribute ServiceWorker? waiting;
-  readonly attribute ServiceWorker? active;
+interface ServiceWorkerRegistration : EventTarget {
+  readonly attribute ServiceWorker? installing;
+  readonly attribute ServiceWorker? waiting;
+  readonly attribute ServiceWorker? active;
 
-  readonly attribute USVString scope;
+  readonly attribute USVString scope;
 
-  [NewObject] Promise<void> update();
-  [NewObject] Promise<boolean> unregister();
+  [NewObject] Promise<void> update();
+  [NewObject] Promise<boolean> unregister();
 
   // event
-  attribute EventHandler onupdatefound;
+  attribute EventHandler onupdatefound;
 };
 
-

A ServiceWorkerRegistration object represents a service worker registration. Each ServiceWorkerRegistration object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration interface across documents and workers can all be associated with the same service worker registration simultaneously.

+

A ServiceWorkerRegistration object represents a service worker registration. Each ServiceWorkerRegistration object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration interface across documents and workers can all be associated with the same service worker registration simultaneously.

- -

installing attribute must return the value to which it was last set.

-

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

+ +

installing attribute must return the value to which it was last set.

+

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

- -

waiting attribute must return the value to which it was last set.

-

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

+ +

waiting attribute must return the value to which it was last set.

+

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

- -

active attribute must return the value to which it was last set.

-

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

+ +

active attribute must return the value to which it was last set.

+

The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

-

3.2.4. scope

-

The scope attribute must return service worker registration’s serialized scope url.

+

3.2.4. scope

+

The scope attribute must return service worker registration’s serialized scope url.

In the example in section 3.1.1, the value of registration.scope, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); }) for example, will be "https://example.com/".

-

3.2.5. update()

-

update() method must run these steps:

+

3.2.5. update()

+

update() method must run these steps:

  1. Let p be a promise. -
  2. Let registration be the service worker registration. +
  3. Let registration be the service worker registration.
  4. Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.
  5. If newestWorker is null, reject p with an "InvalidStateError" exception and abort these steps. -
  6. If the context object’s relevant settings object’s global object globalObject is a ServiceWorkerGlobalScope object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError" exception and abort these steps. +
  7. If the context object’s relevant settings object’s global object globalObject is a ServiceWorkerGlobalScope object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError" exception and abort these steps.
  8. Let job be the result of running Create Job with update, registration’s scope url, newestWorker’s script url, p, and the context object’s relevant settings object client.
  9. Set job’s worker type to newestWorker’s type.
  10. Invoke Schedule Job with job. @@ -1983,19 +1983,19 @@

    -

    -

    The unregister() method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister() method only affects subsequent navigations.

    -

    unregister() method must run these steps:

    + +

    The unregister() method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister() method only affects subsequent navigations.

    +

    unregister() method must run these steps:

    1. Let p be a promise. -
    2. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object’s relevant settings object client. +
    3. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object’s relevant settings object client.
    4. Invoke Schedule Job with job.
    5. Return p.

3.2.7. Event handler

-

The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

+

The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

@@ -2003,68 +2003,68 @@ -
onupdatefound + onupdatefound updatefound
- +
partial interface Navigator {
-  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
+  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
 };
 
 partial interface WorkerNavigator {
-  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
+  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
 };
 
-

The serviceWorker attribute must return the ServiceWorkerContainer object that is associated with the context object.

+

The serviceWorker attribute must return the ServiceWorkerContainer object that is associated with the context object.

-

3.4. ServiceWorkerContainer

+

3.4. ServiceWorkerContainer

[SecureContext, Exposed=(Window,Worker)]
-interface ServiceWorkerContainer : EventTarget {
-  readonly attribute ServiceWorker? controller;
-  [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;
+interface ServiceWorkerContainer : EventTarget {
+  readonly attribute ServiceWorker? controller;
+  [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;
 
-  [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
+  [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
 
-  [NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
-  [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
+  [NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
+  [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
 
-  void startMessages();
+  void startMessages();
 
 
   // events
-  attribute EventHandler oncontrollerchange;
-  attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
+  attribute EventHandler oncontrollerchange;
+  attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
 };
 
-
dictionary RegistrationOptions {
+
dictionary RegistrationOptions {
   USVString scope;
   WorkerType type = "classic";
 };
 
-

The user agent must create a ServiceWorkerContainer object when a Navigator object or a WorkerNavigator object is created and associate it with that object.

-

A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

-

A ServiceWorkerContainer has an associated service worker client, which is a service worker client whose global object is associated with the Navigator object or the WorkerNavigator object that the ServiceWorkerContainer is retrieved from.

-

A ServiceWorkerContainer object has an associated ready promise (a promise). It is initially set to a new promise.

-

A ServiceWorkerContainer object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a ServiceWorkerContainer object’s client message queue is enabled, the event loop must use it as one of its task sources. When the ServiceWorkerContainer object’s relevant global object is a Window object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.

+

The user agent must create a ServiceWorkerContainer object when a Navigator object or a WorkerNavigator object is created and associate it with that object.

+

A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

+

A ServiceWorkerContainer has an associated service worker client, which is a service worker client whose global object is associated with the Navigator object or the WorkerNavigator object that the ServiceWorkerContainer is retrieved from.

+

A ServiceWorkerContainer object has an associated ready promise (a promise). It is initially set to a new promise.

+

A ServiceWorkerContainer object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a ServiceWorkerContainer object’s client message queue is enabled, the event loop must use it as one of its task sources. When the ServiceWorkerContainer object’s relevant global object is a Window object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.

- -

controller attribute must run these steps:

+ +

controller attribute must run these steps:

    -
  1. Let client be the context object’s service worker client. -
  2. Return the ServiceWorker object that represents client’s active service worker. +
  3. Let client be the context object’s service worker client. +
  4. Return the ServiceWorker object that represents client’s active service worker.
-

navigator.serviceWorker.controller returns null if the request is a force refresh (shift+refresh). The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

+

navigator.serviceWorker.controller returns null if the request is a force refresh (shift+refresh). The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

- -

ready attribute must run these steps:

+ +

ready attribute must run these steps:

    -
  1. If the context object’s ready promise is settled, return the context object’s ready promise. -
  2. Let client be the context object’s service worker client. +
  3. If the context object’s ready promise is settled, return the context object’s ready promise. +
  4. Let client be the context object’s service worker client.
  5. Let registration be null.
  6. Let clientURL be client’s creation URL.
  7. @@ -2084,19 +2084,19 @@
-
  • Return context object’s ready promise. +
  • Return context object’s ready promise. -

    When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

    +

    When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

  • - -

    The register(scriptURL, options) method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

    -

    register(scriptURL, options) method must run these steps:

    + +

    The register(scriptURL, options) method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

    +

    register(scriptURL, options) method must run these steps:

    1. Let p be a promise. -
    2. Let client be the context object’s service worker client. +
    3. Let client be the context object’s service worker client.
    4. Let scriptURL be the result of parsing scriptURL with the context object’s relevant settings object’s API base URL.
    5. Let scopeURL be null.
    6. If options.scope is present, set scopeURL to the result of parsing options.scope with the context object’s relevant settings object’s API base URL. @@ -2105,10 +2105,10 @@ -

      getRegistration(clientURL) method must run these steps:

      + +

      getRegistration(clientURL) method must run these steps:

        -
      1. Let client be the context object’s service worker client. +
      2. Let client be the context object’s service worker client.
      3. Let clientURL be the result of parsing clientURL with the context object’s relevant settings object’s API base URL.
      4. If clientURL is failure, return a promise rejected with a TypeError.
      5. If the origin of clientURL is not client’s origin, return a promise rejected with a "SecurityError" exception. @@ -2120,7 +2120,7 @@
    7. Else: @@ -2132,10 +2132,10 @@ -

      getRegistrations() method must run these steps:

      + +

      getRegistrations() method must run these steps:

        -
      1. Let client be the context object’s service worker client. +
      2. Let client be the context object’s service worker client.
      3. Let promise be a new promise.
      4. Run the following substeps in parallel: @@ -2144,7 +2144,7 @@
      @@ -2152,12 +2152,12 @@ -

      startMessages() method must enable the context object’s client message queue if it is not enabled.

      + +

      startMessages() method must enable the context object’s client message queue if it is not enabled.

    3.4.7. Event handlers

    -

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

    +

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

    @@ -2165,59 +2165,59 @@ - -
    oncontrollerchange + oncontrollerchange controllerchange
    onmessage + onmessage message
    -

    The first time the context object’s onmessage IDL attribute is set, its client message queue must be enabled.

    +

    The first time the context object’s onmessage IDL attribute is set, its client message queue must be enabled.

    -

    3.5. ServiceWorkerMessageEvent

    -
    [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
    -interface ServiceWorkerMessageEvent : Event {
    -  readonly attribute any data;
    -  readonly attribute USVString origin;
    -  readonly attribute DOMString lastEventId;
    -  [SameObject] readonly attribute (ServiceWorker or MessagePort)? source;
    -  readonly attribute FrozenArray<MessagePort> ports;
    +     

    3.5. ServiceWorkerMessageEvent

    +
    [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
    +interface ServiceWorkerMessageEvent : Event {
    +  readonly attribute any data;
    +  readonly attribute USVString origin;
    +  readonly attribute DOMString lastEventId;
    +  [SameObject] readonly attribute (ServiceWorker or MessagePort)? source;
    +  readonly attribute FrozenArray<MessagePort> ports;
     };
     
    -
    dictionary ServiceWorkerMessageEventInit : EventInit {
    +
    dictionary ServiceWorkerMessageEventInit : EventInit {
       any data = null;
       USVString origin = "";
       DOMString lastEventId = "";
    -  (ServiceWorker or MessagePort)? source = null;
    +  (ServiceWorker or MessagePort)? source = null;
       sequence<MessagePort> ports = [];
     };
     
    -

    Service workers define the message event that extends the message event defined in [HTML] to allow setting a ServiceWorker object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

    +

    Service workers define the message event that extends the message event defined in [HTML] to allow setting a ServiceWorker object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

    -

    3.5.1. event.data

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    3.5.1. event.data

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    -

    3.5.2. event.origin

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.

    +

    3.5.2. event.origin

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.

    -

    3.5.3. event.lastEventId

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    3.5.3. event.lastEventId

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    -

    3.5.4. event.source

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

    +

    3.5.4. event.source

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

    -

    3.5.5. event.ports

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    +

    3.5.5. event.ports

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    3.6. Events

    -

    The following event is dispatched on ServiceWorker object:

    +

    The following event is dispatched on ServiceWorker object:

    @@ -2226,11 +2226,11 @@

    Dispatched when…

    -
    statechange + statechange Event - The state attribute of the ServiceWorker object is changed. + The state attribute of the ServiceWorker object is changed.
    -

    The following event is dispatched on ServiceWorkerRegistration object:

    +

    The following event is dispatched on ServiceWorkerRegistration object:

    @@ -2241,9 +2241,9 @@

    updatefound Event - The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.) + The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.)
    -

    The following events are dispatched on ServiceWorkerContainer object:

    +

    The following events are dispatched on ServiceWorkerContainer object:

    @@ -2254,10 +2254,10 @@

    controllerchange Event - The service worker client’s active service worker changes. (See step 9.2 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.) + The service worker client’s active service worker changes. (See step 9.2 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.)
    message - ServiceWorkerMessageEvent + ServiceWorkerMessageEvent When it receives a message.
    @@ -2301,39 +2301,39 @@

    4.1. ServiceWorkerGlobalScope

    -
    [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
    -interface ServiceWorkerGlobalScope : WorkerGlobalScope {
    +     

    4.1. ServiceWorkerGlobalScope

    +
    [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
    +interface ServiceWorkerGlobalScope : WorkerGlobalScope {
       // A container for a list of Client objects that correspond to
       // browsing contexts (or shared workers) that are on the origin of this SW
    -  [SameObject] readonly attribute Clients clients;
    -  [SameObject] readonly attribute ServiceWorkerRegistration registration;
    +  [SameObject] readonly attribute Clients clients;
    +  [SameObject] readonly attribute ServiceWorkerRegistration registration;
     
    -  [NewObject] Promise<void> skipWaiting();
    +  [NewObject] Promise<void> skipWaiting();
     
    -  attribute EventHandler oninstall;
    -  attribute EventHandler onactivate;
    -  attribute EventHandler onfetch;
    +  attribute EventHandler oninstall;
    +  attribute EventHandler onactivate;
    +  attribute EventHandler onfetch;
       attribute EventHandler onforeignfetch;
     
       // event
    -  attribute EventHandler onmessage; // event.source of the message events is Client object
    +  attribute EventHandler onmessage; // event.source of the message events is Client object
     };
     
    -

    A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A ServiceWorkerGlobalScope object has an associated service worker (a service worker).

    -

    ServiceWorkerGlobalScope object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

    +

    A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A ServiceWorkerGlobalScope object has an associated service worker (a service worker).

    +

    ServiceWorkerGlobalScope object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

    -

    4.1.1. clients

    -

    clients attribute must return the Clients object that is associated with the context object.

    +

    4.1.1. clients

    +

    clients attribute must return the Clients object that is associated with the context object.

    -

    4.1.2. registration

    -

    The registration attribute must return the ServiceWorkerRegistration object that represents the service worker’s containing service worker registration.

    +

    4.1.2. registration

    +

    The registration attribute must return the ServiceWorkerRegistration object that represents the service worker’s containing service worker registration.

    -

    4.1.3. skipWaiting()

    -

    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:

    +

    4.1.3. skipWaiting()

    +

    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:

    1. Let promise be a new promise.
    2. @@ -2352,7 +2352,7 @@

      4.1.4. Event handlers

      -

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

      +

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

      @@ -2360,65 +2360,65 @@ - - - -
      oninstall + oninstall install
      onactivate + onactivate activate
      onfetch + onfetch fetch
      onforeignfetch foreignfetch
      onmessage + onmessage message
    -

    4.2. Client

    +

    4.2. Client

    [Exposed=ServiceWorker]
    -interface Client {
    -  readonly attribute USVString url;
    -  readonly attribute DOMString id;
    -  readonly attribute boolean reserved;
    -  void postMessage(any message, optional sequence<object> transfer = []);
    +interface Client {
    +  readonly attribute USVString url;
    +  readonly attribute DOMString id;
    +  readonly attribute boolean reserved;
    +  void postMessage(any message, optional sequence<object> transfer = []);
     };
     
     [Exposed=ServiceWorker]
    -interface WindowClient : Client {
    -  readonly attribute VisibilityState visibilityState;
    -  readonly attribute boolean focused;
    -  [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins;
    -  [NewObject] Promise<WindowClient> focus();
    -  [NewObject] Promise<WindowClient> navigate(USVString url);
    +interface WindowClient : Client {
    +  readonly attribute VisibilityState visibilityState;
    +  readonly attribute boolean focused;
    +  [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins;
    +  [NewObject] Promise<WindowClient> focus();
    +  [NewObject] Promise<WindowClient> navigate(USVString url);
     };
     
    -

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

    -

    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).

    -

    A WindowClient object has an associated ancestor origins array.

    +

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

    +

    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).

    +

    A WindowClient object has an associated ancestor origins array.

    -

    4.2.1. url

    -

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

    +

    4.2.1. url

    +

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

    -

    4.2.2. id

    -

    The id attribute must return its associated service worker client’s id.

    +

    4.2.2. id

    +

    The id attribute must return its associated service worker client’s id.

    -

    4.2.3. reserved

    -

    The reserved attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.

    +

    4.2.3. reserved

    +

    The reserved attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.

    Defining the execution ready flag is a work in progress. See the pull request to HTML.

    -

    4.2.4. postMessage(message, transfer)

    -

    The postMessage(message, transfer) method must run these steps:

    +

    4.2.4. postMessage(message, transfer)

    +

    The postMessage(message, transfer) method must run these steps:

    1. Let sourceSettings be the context object’s relevant settings object. -
    2. Let destination be the ServiceWorkerContainer object whose service worker client is the context object’s service worker client. +
    3. Let destination be the ServiceWorkerContainer object whose service worker client is the context object’s service worker client.
    4. If destination is null, throw an "InvalidStateError" exception.
    5. Let targetRealm be destination’s relevant Realm.
    6. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. @@ -2427,42 +2427,42 @@

      Add a task that runs the following steps to destination’s client message queue:
        -
      1. Create an event e that uses the ServiceWorkerMessageEvent interface, with the event type message, which does not bubble and is not cancelable. -
      2. Let the data attribute of e be initialized to clonedMessage. -
      3. Let the origin attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. -
      4. Let the source attribute of e be initialized to a ServiceWorker object, which represents the service worker associated with sourceSettings’s global object. -
      5. Let the ports attribute of e be initialized to newPorts. +
      6. Create an event e that uses the ServiceWorkerMessageEvent interface, with the event type message, which does not bubble and is not cancelable. +
      7. Let the data attribute of e be initialized to clonedMessage. +
      8. Let the origin attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. +
      9. Let the source attribute of e be initialized to a ServiceWorker object, which represents the service worker associated with sourceSettings’s global object. +
      10. Let the ports attribute of e be initialized to newPorts.
      11. Dispatch e at destination.

    -

    4.2.5. visibilityState

    -

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

    +

    4.2.5. visibilityState

    +

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

    -

    4.2.6. focused

    -

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

    +

    4.2.6. focused

    +

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

    -

    4.2.7. ancestorOrigins

    -

    The ancestorOrigins attribute must return the context object’s associated service worker client’s ancestor origins array.

    +

    4.2.7. ancestorOrigins

    +

    The ancestorOrigins attribute must return the context object’s associated service worker client’s ancestor origins array.

    -

    4.2.8. focus()

    -

    The focus() method must run these steps:

    +

    4.2.8. focus()

    +

    The focus() method must run these steps:

    1. If this algorithm is not triggered by user activation, return a promise rejected with an "InvalidAccessError" exception.
    2. Let promise be a new promise.
    3. Run these substeps in parallel:
        -
      1. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
      2. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
      3. Let visibilityState be null.
      4. Let focusState be false.
      5. Let ancestorOrigins be the empty array.
      6. - Queue a task 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: + Queue a task 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. Set visibilityState to browsingContext’s active document’s visibilityState attribute value. @@ -2470,7 +2470,7 @@

          active document’s relevant global object’s Location object’s ancestor origins array.

      7. Wait for task to have executed. -
      8. Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments. +
      9. Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
      10. If windowClient’s focus state is true, resolve promise with windowClient.
      11. Else, reject promise with a TypeError.
      @@ -2478,25 +2478,25 @@

      -

      4.2.9. navigate(url)

      -

      The navigate() method must run these steps:

      +

      4.2.9. navigate(url)

      +

      The navigate() method must run these steps:

      1. Let url be the result of parsing url with the context object’s relevant settings object’s API base URL.
      2. If url is failure, return a promise rejected with a TypeError.
      3. If url is about:blank, return a promise rejected with a TypeError. -
      4. If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a TypeError. +
      5. If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a TypeError.
      6. Let promise be a new promise.
      7. Run these substeps in parallel:
          -
        1. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
        2. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
        3. If browsingContext has discarded its Document, reject promise with a TypeError and abort these steps.
        4. Let navigateFailed to false.
        5. Let visibilityState be null.
        6. Let focusState be false.
        7. Let ancestorOrigins be the empty array.
        8. - Queue a task 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: + Queue a task 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. HandleNavigate: Navigate browsingContext to url with exceptions enabled. The source browsing context must be browsingContext.
          2. If the algorithm steps invoked in the step labeled HandleNavigate throws an exception, set navigateFailed to true. @@ -2507,7 +2507,7 @@

            Wait for task to have executed (including its asynchronous steps).
          3. If navigateFailed is true, reject promise with a TypeError and abort these steps.
          4. - If browsingContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then: + If browsingContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then:
            1. Resolve promise with null.
            2. Abort these steps. @@ -2520,40 +2520,40 @@

    -

    4.3. Clients

    +

    4.3. Clients

    [Exposed=ServiceWorker]
    -interface Clients {
    +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();
    +  [NewObject] Promise<any> get(DOMString id);
    +  [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
    +  [NewObject] Promise<WindowClient?> openWindow(USVString url);
    +  [NewObject] Promise<void> claim();
     };
     
    -
    dictionary ClientQueryOptions {
    +
    dictionary ClientQueryOptions {
       boolean includeUncontrolled = false;
       boolean includeReserved = false;
    -  ClientType type = "window";
    +  ClientType type = "window";
     };
     
    -
    enum ClientType {
    +
    enum ClientType {
       "window",
       "worker",
       "sharedworker",
       "all"
     };
     
    -

    The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

    +

    The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

    -

    4.3.1. get(id)

    -

    The get(id) method must run these steps:

    +

    4.3.1. get(id)

    +

    The get(id) method must run these steps:

    1. Let promise be a new promise.
    2. Run these substeps in parallel:
      1. - For each service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
        1. If client’s id is not id, continue to the next iteration of the loop.
        2. @@ -2599,8 +2599,8 @@

          -

          4.3.2. matchAll(options)

          -

          The matchAll(options) method must run these steps:

          +

          4.3.2. matchAll(options)

          +

          The matchAll(options) method must run these steps:

          1. Let promise be a new promise.
          2. @@ -2608,7 +2608,7 @@

            service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
            1. If client is a type of environment, then: @@ -2623,7 +2623,7 @@

              includeUncontrolled is false, then:
                -
              1. If client’s active service worker is not the associated service worker, continue to the next iteration of the loop. +
              2. If client’s active service worker is not the associated service worker, continue to the next iteration of the loop.
            2. If options.includeReserved is false, then: @@ -2678,8 +2678,8 @@

              -

              4.3.3. openWindow(url)

              -

              The openWindow(url) method must run these steps:

              +

              4.3.3. openWindow(url)

              +

              The openWindow(url) method must run these steps:

              1. Let url be the result of parsing url with the context object’s relevant settings object’s API base URL.
              2. If url is failure, return a promise rejected with a TypeError. @@ -2706,7 +2706,7 @@

                Wait for task to have executed (including its asynchronous steps).
              3. If openWindowFailed is true, reject promise with a TypeError and abort these steps.
              4. - If newContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then: + If newContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then:
                1. Resolve promise with null.
                2. Abort these steps. @@ -2718,16 +2718,16 @@

    -

    4.3.4. claim()

    -

    The claim() method must run these steps:

    +

    4.3.4. claim()

    +

    The claim() method must run these steps:

      -
    1. If the service worker is not an active worker, return a promise rejected with an "InvalidStateError" exception. +
    2. If the service worker is not an active worker, return a promise rejected with an "InvalidStateError" exception.
    3. Let promise be a new promise.
    4. Run the following substeps in parallel:
      1. - For each service worker client client whose origin is the same as the service worker’s origin: + For each service worker client client whose origin is the same as the service worker’s origin:
        1. If client is a type of environment, then: @@ -2740,12 +2740,12 @@

          secure context, continue to the next iteration of the loop.

      2. Let registration be the result of running Match Service Worker Registration algorithm passing client’s creation URL as the argument. -
      3. If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop. +
      4. If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop.
      5. - If client’s active service worker is not the service worker, then: + If client’s active service worker is not the service worker, then:
        1. Invoke Handle Service Worker Client Unload with client as the argument. -
        2. Set client’s active service worker to service worker. +
        3. Set client’s active service worker to service worker.
        4. Invoke Notify Controller Change algorithm with client as the argument.
      @@ -2756,38 +2756,38 @@

      4.4. ExtendableEvent

      +

      4.4. ExtendableEvent

      [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
      -interface ExtendableEvent : Event {
      -  void waitUntil(Promise<any> f);
      +interface ExtendableEvent : Event {
      +  void waitUntil(Promise<any> f);
       };
       
      dictionary ExtendableEventInit : EventInit {
         // Defined for the forward compatibility across the derived events
       };
       
      -

      An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

      -

      An ExtendableEvent object has an associated extensions allowed flag. It is initially set.

      -

      Service workers have two lifecycle events, install and activate. Service workers use the ExtendableEvent interface for activate event and install event.

      -

      Service worker extensions that define event handlers may also use or extend the ExtendableEvent interface.

      -

      When dispatching an event e that uses the ExtendableEvent interface, the user agent must run these steps:

      +

      An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

      +

      An ExtendableEvent object has an associated extensions allowed flag. It is initially set.

      +

      Service workers have two lifecycle events, install and activate. Service workers use the ExtendableEvent interface for activate event and install event.

      +

      Service worker extensions that define event handlers may also use or extend the ExtendableEvent interface.

      +

      When dispatching an event e that uses the ExtendableEvent interface, the user agent must run these steps:

        -
      1. If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps. +
      2. If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps.
      3. Let extendLifetimePromises be an empty array.
      4. Run the following substeps in parallel:
          -
        1. SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises. +
        2. SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises.
        3. Wait until all the promises in extendLifetimePromises settle. -
        4. If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray. +
        5. If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray.
        6. Unset e’s extensions allowed flag.

      The user agent should not terminate the service worker associated with e’s relevant settings object’s global object until e’s extensions allowed flag is unset. However, the user agent may impose a time limit to this lifetime extension.

      -

      4.4.1. event.waitUntil(f)

      -

      waitUntil(f) method extends the lifetime of the event.

      -

      waitUntil(f) method must run these steps:

      +

      4.4.1. event.waitUntil(f)

      +

      waitUntil(f) method extends the lifetime of the event.

      +

      waitUntil(f) method must run these steps:

      1. If the extensions allowed flag is unset, then: @@ -2795,24 +2795,24 @@

        Throw an "InvalidStateError" exception.
      2. Abort these steps.
      -
    5. Add f to the extend lifetime promises. +
    6. Add f to the extend lifetime promises.
    -

    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

    +

    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

    Service workers define the following behaviors for install event and activate event, respectively:

    -

    4.5. InstallEvent

    +

    4.5. InstallEvent

    [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
    -interface InstallEvent : ExtendableEvent {
    -  void registerForeignFetch(ForeignFetchOptions options);
    +interface InstallEvent : ExtendableEvent {
    +  void registerForeignFetch(ForeignFetchOptions options);
     };
     
    -dictionary ForeignFetchOptions {
    +dictionary ForeignFetchOptions {
       required sequence<USVString> scopes;
       required sequence<USVString> origins;
     };
    @@ -2841,7 +2841,7 @@ 

    scopes is empty throw a TypeError and abort these steps. -
  • Let scopeString be the context object’s relevant global object’s service worker’s containing service worker registration’s scope url, serialized. +
  • Let scopeString be the context object’s relevant global object’s service worker’s containing service worker registration’s scope url, serialized.
  • Let subScopeURLs be an empty list of URLs.
  • For each subScope in options.scopes: @@ -2858,19 +2858,19 @@

    4.6. FetchEvent

    -
    [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
    -interface FetchEvent : ExtendableEvent {
    -  [SameObject] readonly attribute Request request;
    -  readonly attribute DOMString clientId;
    -  readonly attribute DOMString reservedClientId;
    -  readonly attribute DOMString targetClientId;
    -  readonly attribute boolean isReload;
    -
    -  void respondWith(Promise<Response> r);
    +     

    4.6. FetchEvent

    +
    [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
    +interface FetchEvent : ExtendableEvent {
    +  [SameObject] readonly attribute Request request;
    +  readonly attribute DOMString clientId;
    +  readonly attribute DOMString reservedClientId;
    +  readonly attribute DOMString targetClientId;
    +  readonly attribute boolean isReload;
    +
    +  void respondWith(Promise<Response> r);
     };
     
    -
    dictionary FetchEventInit : ExtendableEventInit {
    +
    dictionary FetchEventInit : ExtendableEventInit {
       required Request request;
       DOMString clientId = "";
       DOMString reservedClientId = "";
    @@ -2878,39 +2878,39 @@ 

    boolean isReload = false; };

    -

    Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the ExtendableEvent interface.

    -

    Each event using FetchEvent interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

    +

    Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the ExtendableEvent interface.

    +

    Each event using FetchEvent interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

      -
    • wait to respond flag -
    • respond-with entered flag -
    • respond-with error flag +
    • wait to respond flag +
    • respond-with entered flag +
    • respond-with error flag

    -

    4.6.1. event.request

    -

    request attribute must return the value it was initialized to.

    +

    4.6.1. event.request

    +

    request attribute must return the value it was initialized to.

    -

    4.6.2. event.clientId

    -

    clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.6.2. event.clientId

    +

    clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.6.3. event.reservedClientId

    -

    reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.6.3. event.reservedClientId

    +

    reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.6.4. event.targetClientId

    -

    targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.6.4. event.targetClientId

    +

    targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.6.5. event.isReload

    -

    isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

    +

    4.6.5. event.isReload

    +

    isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

    Pressing the refresh button should be considered a reload while clicking a link and pressing the back button should not. The behavior of the Ctrl+l enter is left to the implementations of the user agents.

    -

    4.6.6. event.respondWith(r)

    +

    4.6.6. event.respondWith(r)

    Developers can set the argument r with either a promise that resolves with a Response object or a Response object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.

    -

    respondWith(r) method must run these steps:

    +

    respondWith(r) method must run these steps:

    1. If the dispatch flag is unset, then: @@ -2919,17 +2919,17 @@

      Abort these steps.

  • - If the respond-with entered flag is set, then: + If the respond-with entered flag is set, then:
    1. Throw an "InvalidStateError" exception.
    2. Abort these steps.
  • - Add r to the extend lifetime promises. -

    event.respondWith(r) extends the lifetime of the event by default as if event.waitUntil(r) is called.

    + Add r to the extend lifetime promises. +

    event.respondWith(r) extends the lifetime of the event by default as if event.waitUntil(r) is called.

  • Set the stop propagation flag and stop immediate propagation flag. -
  • Set the respond-with entered flag. -
  • Set the wait to respond flag. +
  • Set the respond-with entered flag. +
  • Set the wait to respond flag.
  • Let targetRealm be the relevant Realm of the context object.
  • Run the following substeps in parallel: @@ -2938,7 +2938,7 @@

    If r rejected, then:
      -
    1. Set the respond-with error flag. +
    2. Set the respond-with error flag.
  • If r resolved with response, then: @@ -2949,7 +2949,7 @@

    If response is disturbed or locked, then:
      -
    1. Set the respond-with error flag. +
    2. Set the respond-with error flag.
  • Else: @@ -2995,42 +2995,42 @@

    Else:
      -
    1. Set the respond-with error flag. +
    2. Set the respond-with error flag.
    -

    If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)

    +

    If the respond-with error flag is set, a network error is returned to Fetch through Handle Fetch algorithm. (See the step 21.1.) Otherwise, the value response is returned to Fetch through Handle Fetch algorithm. (See the step 22.1.)

    -
  • Unset the wait to respond flag. +
  • Unset the wait to respond flag.
  • -

    4.7. ForeignFetchEvent

    -
    [Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker]
    -interface ForeignFetchEvent : ExtendableEvent {
    +     

    4.7. ForeignFetchEvent

    +
    [Constructor(DOMString type, ForeignFetchEventInit eventInitDict), Exposed=ServiceWorker]
    +interface ForeignFetchEvent : ExtendableEvent {
       [SameObject] readonly attribute Request request;
       readonly attribute USVString origin;
     
    -  void respondWith(Promise<ForeignFetchResponse> r);
    +  void respondWith(Promise<ForeignFetchResponse> r);
     };
     
    -dictionary ForeignFetchEventInit : ExtendableEventInit {
    +dictionary ForeignFetchEventInit : ExtendableEventInit {
       required Request request;
       USVString origin = "null";
     };
     
    -dictionary ForeignFetchResponse {
    +dictionary ForeignFetchResponse {
       required Response response;
       USVString origin;
       sequence<ByteString> headers;
     };
     
    -

    Service workers have a functional event foreignfetch. For foreignfetch events, service workers use the ForeignFetchEvent interface which extends the ExtendableEvent interface.

    -

    Each event using ForeignFetchEvent interface has an associated potential response (a response), initially set to null, an associated origin (a USVString or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset:

    +

    Service workers have a functional event foreignfetch. For foreignfetch events, service workers use the ForeignFetchEvent interface which extends the ExtendableEvent interface.

    +

    Each event using ForeignFetchEvent interface has an associated potential response (a response), initially set to null, an associated origin (a USVString or null), initially set to null, an associated list of exposed headers (whose element type is a byte string), initially set to an empty list, and the following associated flags that are initially unset:

      -
    • wait to respond flag -
    • respond-with entered flag -
    • respond-with error flag +
    • wait to respond flag +
    • respond-with entered flag +
    • respond-with error flag

    @@ -3053,15 +3053,15 @@

    respond-with entered flag is set, then: + If the respond-with entered flag is set, then:
    1. Throw an "InvalidStateError" exception.
    2. Abort these steps.
    -
  • Add r to the extend lifetime promises. +
  • Add r to the extend lifetime promises.
  • Set the stop propagation flag and stop immediate propagation flag. -
  • Set the respond-with entered flag. -
  • Set the wait to respond flag. +
  • Set the respond-with entered flag. +
  • Set the wait to respond flag.
  • Let targetRealm be the relevant Realm of the context object.
  • Run the following substeps in parallel: @@ -3070,20 +3070,20 @@

    respond-with error flag. +
  • Set the respond-with error flag.
  • If r resolved with response, then:
    1. - If response is a ForeignFetchResponse, then: + If response is a ForeignFetchResponse, then:
      1. Set the origin to response.origin. -
      2. Set the list of exposed headers to response.headers. +
      3. Set the list of exposed headers to response.headers.
      4. If response.response is disturbed or locked, then:
          -
        1. Set the respond-with error flag. +
        2. Set the respond-with error flag.
      5. Else: @@ -3128,59 +3128,59 @@

        respond-with error flag. +
      6. Set the respond-with error flag.
      -

      If the respond-with error flag is set, a network error is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 20.1.)

      +

      If the respond-with error flag is set, a network error is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 19.1.) Otherwise, a filtered version of response is returned to Fetch through Handle Foreign Fetch algorithm. (See the step 20.1.)

    -
  • Unset the wait to respond flag. +
  • Unset the wait to respond flag.
  • -

    4.8. ExtendableMessageEvent

    -
    [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
    -interface ExtendableMessageEvent : ExtendableEvent {
    -  readonly attribute any data;
    -  readonly attribute USVString origin;
    -  readonly attribute DOMString lastEventId;
    -  [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
    -  readonly attribute FrozenArray<MessagePort> ports;
    +     

    4.8. ExtendableMessageEvent

    +
    [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
    +interface ExtendableMessageEvent : ExtendableEvent {
    +  readonly attribute any data;
    +  readonly attribute USVString origin;
    +  readonly attribute DOMString lastEventId;
    +  [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
    +  readonly attribute FrozenArray<MessagePort> ports;
     };
     
    -
    dictionary ExtendableMessageEventInit : ExtendableEventInit {
    +
    dictionary ExtendableMessageEventInit : ExtendableEventInit {
       any data = null;
       USVString origin = "";
       DOMString lastEventId = "";
    -  (Client or ServiceWorker or MessagePort)? source = null;
    +  (Client or ServiceWorker or MessagePort)? source = null;
       sequence<MessagePort> ports = [];
     };
     
    -

    Service workers define the extendable message event that extends the message event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the ExtendableEvent interface.

    +

    Service workers define the extendable message event that extends the message event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the ExtendableEvent interface.

    -

    4.8.1. event.data

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    4.8.1. event.data

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    -

    4.8.2. event.origin

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    +

    4.8.2. event.origin

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    -

    4.8.3. event.lastEventId

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    4.8.3. event.lastEventId

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    -

    4.8.4. event.source

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the Client object from which the message is sent.

    +

    4.8.4. event.source

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the Client object from which the message is sent.

    -

    4.8.5. event.ports

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    +

    4.8.5. event.ports

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    4.9. Events

    -

    The following events are dispatched on ServiceWorkerGlobalScope object:

    +

    The following events are dispatched on ServiceWorkerGlobalScope object:

    @@ -3190,23 +3190,23 @@

    install - InstallEvent - [Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.) + InstallEvent + [Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.)
    activate - ExtendableEvent - [Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.) + ExtendableEvent + [Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.)
    fetch - FetchEvent - [Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.) + FetchEvent + [Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.)
    foreignfetch - FetchEvent - [Functional event] The http fetch invokes Handle Foreign Fetch with request. As a result of performing Handle Foreign Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.) + FetchEvent + [Functional event] The http fetch invokes Handle Foreign Fetch with request. As a result of performing Handle Foreign Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.)
    message - ExtendableMessageEvent + ExtendableMessageEvent When it receives a message.
    @@ -3233,7 +3233,7 @@
    - +
    partial interface HTMLLinkElement {
       [CEReactions] attribute USVString scope;
       [CEReactions] attribute WorkerType workerType;
    @@ -3276,68 +3276,68 @@ 
    -
    -

    {{ServiceWorker}}

    +
    +

    {{ServiceWorker}}

           [SecureContext, Exposed=(Window,Worker)]
    @@ -301,14 +301,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    A ServiceWorker object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.

    +

    A {{ServiceWorker}} object represents a service worker. Each {{ServiceWorker}} object is associated with a service worker. Multiple separate objects implementing the {{ServiceWorker}} interface across documents and workers can all be associated with the same service worker simultaneously.

    A {{ServiceWorker}} object has an associated {{ServiceWorkerState}} object which is itself associated with service worker's state.

    {{ServiceWorker/scriptURL}}

    -

    The scriptURL attribute must return the service worker's serialized script url.

    +

    The scriptURL attribute must return the service worker's serialized script url.

    For example, consider a document created by a navigation to https://example.com/app.html which matches via the following registration call which has been previously executed:

    @@ -325,13 +325,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{ServiceWorker/state}}

    -

    The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

    +

    The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

    {{ServiceWorker/postMessage(message, transfer)}}

    -

    The postMessage(message, transfer) method must run these steps:

    +

    The postMessage(message, transfer) method must run these steps:

    1. If the {{ServiceWorker/state}} attribute value of the context object is "redundant", throw an "{{InvalidStateError}}" exception and abort these steps.
    2. @@ -348,7 +348,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    3. Create an event e that uses the {{ExtendableMessageEvent}} interface, with the event type message, which does not bubble and is not cancelable.
    4. Let the {{ExtendableMessageEvent/data}} attribute of e be initialized to clonedMessage.
    5. Let the {{ExtendableMessageEvent/origin}} attribute of e be initialized to the Unicode serialization of incumbentSettings's origin.
    6. -
    7. If incumbentGlobal is a {{ServiceWorkerGlobalScope}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{ServiceWorker}} object that represents incumbentGlobal's service worker.
    8. +
    9. If incumbentGlobal is a {{ServiceWorkerGlobalScope}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{ServiceWorker}} object that represents incumbentGlobal's service worker.
    10. Else if incumbentGlobal is a {{Window}} object, let the {{ExtendableMessageEvent/source}} attribute of e be initialized to a new {{WindowClient}} object that represents incumbentGlobal's browsing context.
    11. Else, let it be initialized to a new {{Client}} object that represents the worker associated with incumbentGlobal.
    12. Let the {{ExtendableMessageEvent/ports}} attribute of e be initialized to newPorts.
    13. @@ -373,16 +373,16 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - onstatechange - statechange + onstatechange + {{ServiceWorker/statechange}}
    -
    -

    {{ServiceWorkerRegistration}}

    +
    +

    {{ServiceWorkerRegistration}}

           [SecureContext, Exposed=(Window,Worker)]
    @@ -401,12 +401,12 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    A ServiceWorkerRegistration object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.

    +

    A {{ServiceWorkerRegistration}} object represents a service worker registration. Each {{ServiceWorkerRegistration}} object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the {{ServiceWorkerRegistration}} interface across documents and workers can all be associated with the same service worker registration simultaneously.

    -

    installing attribute must return the value to which it was last set.

    +

    installing attribute must return the value to which it was last set.

    The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

    @@ -414,7 +414,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    -

    waiting attribute must return the value to which it was last set.

    +

    waiting attribute must return the value to which it was last set.

    The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

    @@ -422,7 +422,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
    -

    active attribute must return the value to which it was last set.

    +

    active attribute must return the value to which it was last set.

    The {{ServiceWorker}} objects returned from this attribute getter that represent the same service worker are the same objects.

    @@ -430,7 +430,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{ServiceWorkerRegistration/scope}}

    -

    The scope attribute must return service worker registration's serialized scope url.

    +

    The scope attribute must return service worker registration's serialized scope url.

    In the example in section 3.1.1, the value of registration.scope, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); }) for example, will be "https://example.com/".

    @@ -438,14 +438,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    {{ServiceWorkerRegistration/update()}}

    -

    update() method must run these steps:

    +

    update() method must run these steps:

    1. Let p be a promise.
    2. -
    3. Let registration be the service worker registration.
    4. +
    5. Let registration be the service worker registration.
    6. Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.
    7. If newestWorker is null, reject p with an "{{InvalidStateError}}" exception and abort these steps.
    8. -
    9. If the context object's relevant settings object's global object globalObject is a {{ServiceWorkerGlobalScope}} object, and globalObject's associated service worker's state is installing, reject p with an "{{InvalidStateError}}" exception and abort these steps.
    10. +
    11. If the context object's relevant settings object's global object globalObject is a {{ServiceWorkerGlobalScope}} object, and globalObject's associated service worker's state is installing, reject p with an "{{InvalidStateError}}" exception and abort these steps.
    12. Let job be the result of running Create Job with update, registration's scope url, newestWorker's script url, p, and the context object's relevant settings object client.
    13. Set job's worker type to newestWorker's type.
    14. Invoke Schedule Job with job.
    15. @@ -458,11 +458,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      The {{ServiceWorkerRegistration/unregister()}} method unregisters the service worker registration. It is important to note that the currently controlled service worker client's active service worker's containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the {{ServiceWorkerRegistration/unregister()}} method only affects subsequent navigations.

      -

      unregister() method must run these steps:

      +

      unregister() method must run these steps:

      1. Let p be a promise.
      2. -
      3. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object's relevant settings object client.
      4. +
      5. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object's relevant settings object client.
      6. Invoke Schedule Job with job.
      7. Return p.
      @@ -471,7 +471,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      Event handler

      -

      The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

      +

      The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing {{ServiceWorkerRegistration}} interface:

      @@ -482,7 +482,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + @@ -491,7 +491,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      - +
             partial interface Navigator {
      @@ -506,8 +506,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           

      The serviceWorker attribute must return the {{ServiceWorkerContainer}} object that is associated with the context object.

      -
      -

      {{ServiceWorkerContainer}}

      +
      +

      {{ServiceWorkerContainer}}

             [SecureContext, Exposed=(Window,Worker)]
      @@ -537,21 +537,21 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
       
         

      The user agent must create a {{ServiceWorkerContainer}} object when a {{Navigator}} object or a {{WorkerNavigator}} object is created and associate it with that object.

      -

      A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

      +

      A {{ServiceWorkerContainer}} provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

      -

      A {{ServiceWorkerContainer}} has an associated service worker client, which is a service worker client whose global object is associated with the {{Navigator}} object or the {{WorkerNavigator}} object that the {{ServiceWorkerContainer}} is retrieved from.

      +

      A {{ServiceWorkerContainer}} has an associated service worker client, which is a service worker client whose global object is associated with the {{Navigator}} object or the {{WorkerNavigator}} object that the {{ServiceWorkerContainer}} is retrieved from.

      -

      A {{ServiceWorkerContainer}} object has an associated ready promise (a promise). It is initially set to a new promise.

      +

      A {{ServiceWorkerContainer}} object has an associated ready promise (a promise). It is initially set to a new promise.

      A {{ServiceWorkerContainer}} object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a {{ServiceWorkerContainer}} object's client message queue is enabled, the event loop must use it as one of its task sources. When the {{ServiceWorkerContainer}} object's relevant global object is a {{Window}} object, all tasks queued on its client message queue must be associated with its relevant settings object's responsible document.

      -

      controller attribute must run these steps:

      +

      controller attribute must run these steps:

        -
      1. Let client be the context object's service worker client.
      2. +
      3. Let client be the context object's service worker client.
      4. Return the {{ServiceWorker}} object that represents client's active service worker.
      @@ -562,11 +562,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      -

      ready attribute must run these steps:

      +

      ready attribute must run these steps:

        -
      1. If the context object's ready promise is settled, return the context object's ready promise.
      2. -
      3. Let client be the context object's service worker client.
      4. +
      5. If the context object's ready promise is settled, return the context object's ready promise.
      6. +
      7. Let client be the context object's service worker client.
      8. Let registration be null.
      9. Let clientURL be client's creation URL.
      10. Run the following substeps in parallel: @@ -585,13 +585,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      11. If registration's active worker is null, wait until registration's active worker changes.

        Implementers should consider this condition is met when the corresponding registration request gets to the step 6 of Activate algorithm.

      12. -
      13. Resolve context object's ready promise with the {{ServiceWorkerRegistration}} object which represents registration.
      14. +
      15. Resolve context object's ready promise with the {{ServiceWorkerRegistration}} object which represents registration.
      -
    16. Return context object's ready promise.
    17. +
    18. Return context object's ready promise.
    19. -

      When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

      +

      When the {{ServiceWorkerContainer/ready}} attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

      @@ -599,11 +599,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      The {{ServiceWorkerContainer/register(scriptURL, options)}} method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

      -

      register(scriptURL, options) method must run these steps:

      +

      register(scriptURL, options) method must run these steps:

      1. Let p be a promise.
      2. -
      3. Let client be the context object's service worker client.
      4. +
      5. Let client be the context object's service worker client.
      6. Let scriptURL be the result of parsing scriptURL with the context object's relevant settings object's API base URL.
      7. If scriptURL is failure, reject p with a TypeError and abort these steps.
      8. If scriptURL's scheme is not one of "http" and "https", reject p with a TypeError and abort these steps.
      9. @@ -625,10 +625,10 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
        -

        getRegistration(clientURL) method must run these steps:

        +

        getRegistration(clientURL) method must run these steps:

          -
        1. Let client be the context object's service worker client.
        2. +
        3. Let client be the context object's service worker client.
        4. Let clientURL be the result of parsing clientURL with the context object's relevant settings object's API base URL.
        5. If clientURL is failure, return a promise rejected with a TypeError.
        6. If the origin of clientURL is not client's origin, return a promise rejected with a "{{SecurityError}}" exception.
        7. @@ -655,10 +655,10 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
          -

          getRegistrations() method must run these steps:

          +

          getRegistrations() method must run these steps:

            -
          1. Let client be the context object's service worker client.
          2. +
          3. Let client be the context object's service worker client.
          4. Let promise be a new promise.
          5. Run the following substeps in parallel:
              @@ -678,13 +678,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
              -

              startMessages() method must enable the context object's client message queue if it is not enabled.

              +

              startMessages() method must enable the context object's client message queue if it is not enabled.

              Event handlers

              -

              The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

              +

              The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the {{ServiceWorkerContainer}} interface:

      onupdatefoundonupdatefound updatefound
      @@ -695,22 +695,22 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - +
      oncontrollerchangeoncontrollerchange controllerchange
      onmessageonmessage message
      -

      The first time the context object's onmessage IDL attribute is set, its client message queue must be enabled.

      +

      The first time the context object's {{ServiceWorkerContainer/onmessage}} IDL attribute is set, its client message queue must be enabled.

    -
    -

    {{ServiceWorkerMessageEvent}}

    +
    +

    {{ServiceWorkerMessageEvent}}

           [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
    @@ -732,36 +732,36 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

    +

    Service workers define the message event that extends the {{Window/message}} event defined in [[!HTML]] to allow setting a {{ServiceWorker}} object as the source of the message. For the message event, service workers use the {{ServiceWorkerMessageEvent}} interface.

    {{ServiceWorkerMessageEvent/data|event.data}}

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    {{ServiceWorkerMessageEvent/origin|event.origin}}

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker's environment settings object from which the message is sent.

    {{ServiceWorkerMessageEvent/lastEventId|event.lastEventId}}

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    {{ServiceWorkerMessageEvent/source|event.source}}

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{ServiceWorker}} object whose associated service worker the message is sent from.

    {{ServiceWorkerMessageEvent/ports|event.ports}}

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

    @@ -780,7 +780,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - statechange + statechange {{Event}} The {{ServiceWorker/state}} attribute of the {{ServiceWorker}} object is changed. @@ -801,7 +801,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 updatefound {{Event}} - The service worker registration's installing worker changes. (See step 8 of the Install algorithm.) + The service worker registration's installing worker changes. (See step 8 of the Install algorithm.) @@ -820,7 +820,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 controllerchange {{Event}} - The service worker client's active service worker changes. (See step 9.2 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, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the active worker as the service worker that controls the service worker client.) + The service worker client's active service worker changes. (See step 9.2 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, {{ServiceWorkerContainer/controller|navigator.serviceWorker.controller}} immediately reflects the active worker as the service worker that controls the service worker client.) message @@ -874,8 +874,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 -
    -

    {{ServiceWorkerGlobalScope}}

    +
    +

    {{ServiceWorkerGlobalScope}}

           [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
    @@ -896,20 +896,20 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
           };
         
    -

    A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).

    +

    A {{ServiceWorkerGlobalScope}} object represents the global execution context of a service worker. A {{ServiceWorkerGlobalScope}} object has an associated service worker (a service worker).

    {{ServiceWorkerGlobalScope}} object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

    {{ServiceWorkerGlobalScope/clients}}

    -

    clients attribute must return the {{Clients}} object that is associated with the context object.

    +

    clients attribute must return the {{Clients}} object that is associated with the context object.

    {{ServiceWorkerGlobalScope/registration}}

    -

    The registration attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.

    +

    The registration attribute must return the {{ServiceWorkerRegistration}} object that represents the service worker's containing service worker registration.

    @@ -917,7 +917,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

    The {{ServiceWorkerGlobalScope/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:

    +

    skipWaiting() method must run these steps:

    1. Let promise be a new promise.
    2. @@ -939,7 +939,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      Event handlers

      -

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

      +

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the {{ServiceWorkerGlobalScope}} interface:

      @@ -950,19 +950,19 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - + - + - + @@ -971,7 +971,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      -

      {{Client}}

      +

      {{Client}}

             [Exposed=ServiceWorker]
      @@ -992,7 +992,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
             };
           
      -

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

      +

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

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

      @@ -1003,19 +1003,19 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      {{Client/url}}

      -

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

      +

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

      {{Client/id}}

      -

      The id attribute must return its associated service worker client's id.

      +

      The id attribute must return its associated service worker client's id.

      {{Client/reserved}}

      -

      The reserved attribute must return true if the context object's associated service worker client's execution ready flag is unset, and false otherwise.

      +

      The reserved attribute must return true if the context object's associated service worker client's execution ready flag is unset, and false otherwise.

      Defining the execution ready flag is a work in progress. See the pull request to HTML.

      @@ -1023,11 +1023,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      {{Client/postMessage(message, transfer)}}

      -

      The postMessage(message, transfer) method must run these steps:

      +

      The postMessage(message, transfer) method must run these steps:

      1. Let sourceSettings be the context object's relevant settings object.
      2. -
      3. Let destination be the {{ServiceWorkerContainer}} object whose service worker client is the context object's service worker client.
      4. +
      5. Let destination be the {{ServiceWorkerContainer}} object whose service worker client is the context object's service worker client.
      6. If destination is null, throw an "{{InvalidStateError}}" exception.
      7. Let targetRealm be destination's relevant Realm.
      8. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
      9. @@ -1038,7 +1038,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      10. Create an event e that uses the {{ServiceWorkerMessageEvent}} interface, with the event type message, which does not bubble and is not cancelable.
      11. Let the {{ServiceWorkerMessageEvent/data}} attribute of e be initialized to clonedMessage.
      12. Let the {{ServiceWorkerMessageEvent/origin}} attribute of e be initialized to the Unicode serialization of sourceSettings's origin.
      13. -
      14. Let the {{ServiceWorkerMessageEvent/source}} attribute of e be initialized to a {{ServiceWorker}} object, which represents the service worker associated with sourceSettings's global object.
      15. +
      16. Let the {{ServiceWorkerMessageEvent/source}} attribute of e be initialized to a {{ServiceWorker}} object, which represents the service worker associated with sourceSettings's global object.
      17. Let the {{ServiceWorkerMessageEvent/ports}} attribute of e be initialized to newPorts.
      18. Dispatch e at destination.
      @@ -1049,36 +1049,36 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

      {{WindowClient/visibilityState}}

      -

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

      +

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

      {{WindowClient/focused}}

      -

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

      +

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

      {{WindowClient/ancestorOrigins}}

      -

      The ancestorOrigins attribute must return the context object's associated service worker client's ancestor origins array.

      +

      The ancestorOrigins attribute must return the context object's associated service worker client's ancestor origins array.

      {{WindowClient/focus()}}

      -

      The focus() method must run these steps:

      +

      The focus() method must run these steps:

      1. If this algorithm is not triggered by user activation, return a promise rejected with an "{{InvalidAccessError}}" exception.
      2. Let promise be a new promise.
      3. Run these substeps in parallel:
          -
        1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
        2. +
        3. Let browsingContext be the context object's associated service worker client's global object's browsing context.
        4. Let visibilityState be null.
        5. Let focusState be false.
        6. Let ancestorOrigins be the empty array.
        7. -
        8. Queue a task 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: +
        9. Queue a task 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. Set visibilityState to browsingContext's active document's {{Document/visibilityState}} attribute value.
          3. @@ -1087,7 +1087,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
        10. Wait for task to have executed.
        11. -
        12. Let windowClient be the result of running Create Window Client algorithm with the context object's associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
        13. +
        14. Let windowClient be the result of running Create Window Client algorithm with the context object's associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
        15. If windowClient's focus state is true, resolve promise with windowClient.
        16. Else, reject promise with a TypeError.
        @@ -1099,23 +1099,23 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

        {{WindowClient/navigate(url)}}

        -

        The navigate() method must run these steps:

        +

        The navigate() method must run these steps:

        1. Let url be the result of parsing url with the context object's relevant settings object's API base URL.
        2. If url is failure, return a promise rejected with a TypeError.
        3. If url is about:blank, return a promise rejected with a TypeError.
        4. -
        5. If the context object's associated service worker client's active service worker is not the context object's relevant global object's service worker, return a promise rejected with a TypeError.
        6. +
        7. If the context object's associated service worker client's active service worker is not the context object's relevant global object's service worker, return a promise rejected with a TypeError.
        8. Let promise be a new promise.
        9. Run these substeps in parallel:
            -
          1. Let browsingContext be the context object's associated service worker client's global object's browsing context.
          2. +
          3. Let browsingContext be the context object's associated service worker client's global object's browsing context.
          4. If browsingContext has discarded its {{Document}}, reject promise with a TypeError and abort these steps.
          5. Let navigateFailed to false.
          6. Let visibilityState be null.
          7. Let focusState be false.
          8. Let ancestorOrigins be the empty array.
          9. -
          10. Queue a task 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: +
          11. Queue a task 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. HandleNavigate: Navigate browsingContext to url with exceptions enabled. The source browsing context must be browsingContext.
            2. If the algorithm steps invoked in the step labeled HandleNavigate throws an exception, set navigateFailed to true.
            3. @@ -1126,7 +1126,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
            4. Wait for task to have executed (including its asynchronous steps).
            5. If navigateFailed is true, reject promise with a TypeError and abort these steps.
            6. -
            7. If browsingContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then: +
            8. If browsingContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then:
              1. Resolve promise with null.
              2. Abort these steps.
              3. @@ -1141,8 +1141,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
      -
      -

      {{Clients}}

      +
      +

      {{Clients}}

             [Exposed=ServiceWorker]
      @@ -1170,18 +1170,18 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
             };
           
      -

      The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

      +

      The user agent must create a {{Clients}} object when a {{ServiceWorkerGlobalScope}} object is created and associate it with that object.

      {{Clients/get(id)}}

      -

      The get(id) method must run these steps:

      +

      The get(id) method must run these steps:

      1. Let promise be a new promise.
      2. Run these substeps in parallel:
          -
        1. For each service worker client client whose origin is the same as the associated service worker's origin: +
        2. For each service worker client client whose origin is the same as the associated service worker's origin:
          1. If client's id is not id, continue to the next iteration of the loop.
          2. If client is a type of environment, then: @@ -1232,14 +1232,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

            {{Clients/matchAll(options)}}

            -

            The matchAll(options) method must run these steps:

            +

            The matchAll(options) method must run these steps:

            1. Let promise be a new promise.
            2. Run these substeps in parallel:
              1. Let targetClients be an empty array.
              2. -
              3. For each service worker client client whose origin is the same as the associated service worker's origin: +
              4. For each service worker client client whose origin is the same as the associated service worker's origin:
                1. If client is a type of environment, then:
                    @@ -1253,7 +1253,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                  1. If options.{{ClientQueryOptions/includeUncontrolled}} is false, then:
                      -
                    1. If client's active service worker is not the associated service worker, continue to the next iteration of the loop.
                    2. +
                    3. If client's active service worker is not the associated service worker, continue to the next iteration of the loop.
                  2. If options.{{ClientQueryOptions/includeReserved}} is false, then: @@ -1314,7 +1314,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                    {{Clients/openWindow(url)}}

                    -

                    The openWindow(url) method must run these steps:

                    +

                    The openWindow(url) method must run these steps:

                    1. Let url be the result of parsing url with the context object's relevant settings object's API base URL.
                    2. @@ -1340,7 +1340,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                    3. Wait for task to have executed (including its asynchronous steps).
                    4. If openWindowFailed is true, reject promise with a TypeError and abort these steps.
                    5. -
                    6. If newContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then: +
                    7. If newContext's {{Window}} object's environment settings object's creation URL's origin is not the same as the service worker's origin, then:
                      1. Resolve promise with null.
                      2. Abort these steps.
                      3. @@ -1357,14 +1357,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                        {{Clients/claim()}}

                        -

                        The claim() method must run these steps:

                        +

                        The claim() method must run these steps:

                          -
                        1. If the service worker is not an active worker, return a promise rejected with an "{{InvalidStateError}}" exception.
                        2. +
                        3. If the service worker is not an active worker, return a promise rejected with an "{{InvalidStateError}}" exception.
                        4. Let promise be a new promise.
                        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: +
                          2. For each service worker client client whose origin is the same as the service worker's origin:
                            1. If client is a type of environment, then:
                                @@ -1377,11 +1377,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                            2. Let registration be the result of running Match Service Worker Registration algorithm passing client's creation URL as the argument.
                            3. -
                            4. If registration is not the service worker's containing service worker registration, continue to the next iteration of the loop.
                            5. -
                            6. If client's active service worker is not the service worker, then: +
                            7. If registration is not the service worker's containing service worker registration, continue to the next iteration of the loop.
                            8. +
                            9. If client's active service worker is not the service worker, then:
                              1. Invoke Handle Service Worker Client Unload with client as the argument.
                              2. -
                              3. Set client's active service worker to service worker.
                              4. +
                              5. Set client's active service worker to service worker.
                              6. Invoke Notify Controller Change algorithm with client as the argument.
                            10. @@ -1396,7 +1396,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                        -

                        {{ExtendableEvent}}

                        +

                        {{ExtendableEvent}}

                               [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
                        @@ -1410,7 +1410,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                               };
                             
                        -

                        An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

                        +

                        An {{ExtendableEvent}} object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

                        An {{ExtendableEvent}} object has an associated extensions allowed flag. It is initially set.

                        @@ -1440,7 +1440,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                        {{ExtendableEvent/waitUntil(f)}} method extends the lifetime of the event.

                        -

                        waitUntil(f) method must run these steps:

                        +

                        waitUntil(f) method must run these steps:

                        1. If the extensions allowed flag is unset, then: @@ -1449,11 +1449,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                        2. Abort these steps.
                        -
                      4. Add f to the extend lifetime promises.
                      5. +
                      6. Add f to the extend lifetime promises.
                    -

                    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

                    +

                    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

                    Service workers define the following behaviors for install event and activate event, respectively:

                    @@ -1463,8 +1463,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
            -
            -

            {{FetchEvent}}

            +
            +

            {{FetchEvent}}

                   [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
            @@ -1488,7 +1488,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                   };
                 
            -

            Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the {{ExtendableEvent}} interface.

            +

            Service workers have an essential functional event fetch. For fetch event, service workers use the {{FetchEvent}} interface which extends the {{ExtendableEvent}} interface.

            Each event using {{FetchEvent}} interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

              @@ -1501,31 +1501,31 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

              {{FetchEvent/request|event.request}}

              -

              request attribute must return the value it was initialized to.

              +

              request attribute must return the value it was initialized to.

              {{FetchEvent/clientId|event.clientId}}

              -

              clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              +

              clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              {{FetchEvent/reservedClientId|event.reservedClientId}}

              -

              reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              +

              reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              {{FetchEvent/targetClientId|event.targetClientId}}

              -

              targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              +

              targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

              {{FetchEvent/isReload|event.isReload}}

              -

              isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

              +

              isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

              Pressing the refresh button should be considered a reload while clicking a link and pressing the back button should not. The behavior of the Ctrl+l enter is left to the implementations of the user agents.

              @@ -1535,7 +1535,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

              Developers can set the argument r with either a promise that resolves with a {{Response}} object or a {{Response}} object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.

              -

              respondWith(r) method must run these steps:

              +

              respondWith(r) method must run these steps:

              1. If the dispatch flag is unset, then: @@ -1632,8 +1632,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
            -
            -

            {{ExtendableMessageEvent}}

            +
            +

            {{ExtendableMessageEvent}}

                   [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
            @@ -1655,43 +1655,43 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                   };
                 
            -

            Service workers define the extendable message event that extends the {{Window/message}} event defined in [[!HTML]] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the {{ExtendableEvent}} interface.

            +

            Service workers define the extendable message event that extends the {{Window/message}} event defined in [[!HTML]] to allow extending the lifetime of the event. For the message event, service workers use the {{ExtendableMessageEvent}} interface which extends the {{ExtendableEvent}} interface.

            {{ExtendableMessageEvent/data|event.data}}

            -

            The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

            +

            The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

            {{ExtendableMessageEvent/origin|event.origin}}

            -

            The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

            +

            The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

            {{ExtendableMessageEvent/lastEventId|event.lastEventId}}

            -

            The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

            +

            The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

            {{ExtendableMessageEvent/source|event.source}}

            -

            The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{Client}} object from which the message is sent.

            +

            The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the {{Client}} object from which the message is sent.

            {{ExtendableMessageEvent/ports|event.ports}}

            -

            The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

            +

            The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the {{MessagePort}} array being sent.

            Events

            -

            The following events are dispatched on ServiceWorkerGlobalScope object:

            +

            The following events are dispatched on {{ServiceWorkerGlobalScope}} object:

      oninstalloninstall install
      onactivateonactivate activate
      onfetchonfetch fetch
      onmessageonmessage message
      @@ -1705,17 +1705,17 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 - + - + - + @@ -1767,8 +1767,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231 -
      -

      {{Cache}}

      +
      +

      {{Cache}}

             [SecureContext, Exposed=(Window,Worker)]
      @@ -1799,14 +1799,14 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
             };
           
      -

      A Cache object represents a request to response map. Multiple separate objects implementing the {{Cache}} interface across documents and workers can all be associated with the same request to response map simultaneously.

      +

      A {{Cache}} object represents a request to response map. Multiple separate objects implementing the {{Cache}} interface across documents and workers can all be associated with the same request to response map simultaneously.

      {{Cache}} objects are always enumerable via {{WindowOrWorkerGlobalScope/caches|self.caches}} in insertion order (per ECMAScript 6 Map objects).

      {{Cache/match(request, options)}}

      -

      match(request, options) method must run these steps:

      +

      match(request, options) method must run these steps:

      1. Let promise be a new promise.
      2. @@ -1842,7 +1842,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

        {{Cache/matchAll(request, options)}}

        -

        matchAll(request, options) method must run these steps:

        +

        matchAll(request, options) method must run these steps:

        1. Let r be null.
        2. @@ -1899,7 +1899,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

          {{Cache/add(request)}}

          -

          add(request) method must run these steps:

          +

          add(request) method must run these steps:

          1. Let requests be an array containing only request.
          2. @@ -1911,7 +1911,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

            {{Cache/addAll(requests)}}

            -

            addAll(requests) method must run these steps:

            +

            addAll(requests) method must run these steps:

            1. Let responsePromiseArray be an empty array.
            2. @@ -2031,7 +2031,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

              {{Cache/put(request, response)}}

              -

              put(request, response) method must run these steps:

              +

              put(request, response) method must run these steps:

              1. Let r be null.
              2. @@ -2112,7 +2112,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                {{Cache/delete(request, options)}}

                -

                delete(request, options) method must run these steps:

                +

                delete(request, options) method must run these steps:

                1. Let r be null.
                2. @@ -2146,7 +2146,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                  {{Cache/keys(request, options)}}

                  -

                  keys(request, options) method must run these steps:

                  +

                  keys(request, options) method must run these steps:

                  1. Let promise be a new promise.
                  2. @@ -2192,7 +2192,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                -
                +

                {{CacheStorage}}

                @@ -2211,12 +2211,12 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                 
                     

                The user agent must create a {{CacheStorage}} object when a {{Window}} object or a {{WorkerGlobalScope}} object is created and associate it with that global object.

                -

                A CacheStorage object represents a name to cache map of its associated global object's environment settings object's origin. Multiple separate objects implementing the {{CacheStorage}} interface across documents and workers can all be associated with the same name to cache map simultaneously.

                +

                A {{CacheStorage}} object represents a name to cache map of its associated global object's environment settings object's origin. Multiple separate objects implementing the {{CacheStorage}} interface across documents and workers can all be associated with the same name to cache map simultaneously.

                {{CacheStorage/match(request, options)}}

                -

                match(request, options) method must run these steps:

                +

                match(request, options) method must run these steps:

                1. If options.{{CacheQueryOptions/cacheName}} is present, then: @@ -2260,7 +2260,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                  {{CacheStorage/has(cacheName)}}

                  -

                  has(cacheName) method must run these steps:

                  +

                  has(cacheName) method must run these steps:

                  1. Return a promise p resolved with the result of running the following substeps: @@ -2283,7 +2283,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                    {{CacheStorage/open(cacheName)}}

                    -

                    open(cacheName) method must run these steps:

                    +

                    open(cacheName) method must run these steps:

                    1. Let p be a new promise.
                    2. @@ -2311,7 +2311,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                      {{CacheStorage/delete(cacheName)}}

                      -

                      delete(cacheName) method must run these steps:

                      +

                      delete(cacheName) method must run these steps:

                      1. Let p be the result of running the algorithm specified in {{CacheStorage/has(cacheName)}} method with cacheName as the argument.
                      2. @@ -2338,7 +2338,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                        {{CacheStorage/keys()}}

                        -

                        keys() method must run these steps:

                        +

                        keys() method must run these steps:

                        The promise returned from this method resolves with the sequence of keys, cache names in DOMString, in insertion order.

                        @@ -2397,7 +2397,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

                        When the importScripts(urls) method is called on a {{ServiceWorkerGlobalScope}} object, the user agent must import scripts into worker global scope, given this {{ServiceWorkerGlobalScope}} object and urls, and with the following steps to perform the fetch given the request request:

                          -
                        1. Let serviceWorker be request's client's global object's service worker.
                        2. +
                        3. Let serviceWorker be request's client's global object's service worker.
                        4. If serviceWorker's imported scripts updated flag is unset, then:
                          1. Let response be the result of fetching request.
                          2. @@ -3055,7 +3055,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          3. If script's has ever been evaluated flag is unset, then:
                              -
                            1. Set workerGlobalScope's associated service worker's set of event types to handle to the set of event types created from settingsObject's global object's associated list of event listeners' event types. +
                            2. Set workerGlobalScope's associated service worker's set of event types to handle to the set of event types created from settingsObject's global object's associated list of event listeners' event types.

                              If the global object's associated list of event listeners does not have any event listener added at this moment, the service worker's set of event types to handle is set to an empty set. The user agents are encouraged to show a warning that the event listeners must be added on the very first evaluation of the worker script.

                            3. Set script's has ever been evaluated flag.
                            4. @@ -3149,11 +3149,11 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                            5. Queue a task task to run the following substeps:
                              1. Create a trusted event e that uses the {{FetchEvent}} interface, with the event type fetch, which does not bubble.
                              2. -
                              3. Let the request attribute of e be initialized to r.
                              4. +
                              5. Let the {{FetchEvent/request}} attribute of e be initialized to r.
                              6. Initialize e's {{FetchEvent/clientId}} attribute to client's id.
                              7. If request is a non-subresource request and request's destination is not "report", initialize e's {{FetchEvent/reservedClientId}} attribute to reservedClient's id, and to the empty string otherwise.
                              8. If request is a navigation request, initialize e's {{FetchEvent/targetClientId}} attribute to request's target client id, and to the empty string otherwise.
                              9. -
                              10. Let the isReload attribute of e be initialized to true if request's client is a window client and the event was dispatched with the user's intention for the page reload, and false otherwise.
                              11. +
                              12. Let the {{FetchEvent/isReload}} attribute of e be initialized to true if request's client is a window client and the event was dispatched with the user's intention for the page reload, and false otherwise.
                              13. Dispatch e at activeWorker's environment settings object's global object.
                              14. If e's respond-with entered flag is set, set respondWithEntered to true.
                              15. If e's wait to respond flag is set, then: @@ -3197,7 +3197,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                Input
                                -
                                registration, a service worker registration
                                +
                                registration, a service worker registration
                                callbackSteps, an algorithm
                                Output
                                None
                                @@ -3380,7 +3380,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                              16. Set registration's installing worker to source.
                              17. For each registrationObject in registrationObjects:
                                  -
                                1. Queue a task to set the installing attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s installing worker, or null if registration’s installing worker is null.
                                2. +
                                3. Queue a task to set the {{ServiceWorkerRegistration/installing}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s installing worker, or null if registration’s installing worker is null.
                              @@ -3390,7 +3390,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                            6. Set registration's waiting worker to source.
                            7. For each registrationObject in registrationObjects:
                                -
                              1. Queue a task to set the waiting attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s waiting worker, or null if registration’s waiting worker is null.
                              2. +
                              3. Queue a task to set the {{ServiceWorkerRegistration/waiting}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s waiting worker, or null if registration’s waiting worker is null.
                            @@ -3400,7 +3400,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          4. Set registration's active worker to source.
                          5. For each registrationObject in registrationObjects:
                              -
                            1. Queue a task to set the active attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s active worker, or null if registration’s active worker is null.
                            2. +
                            3. Queue a task to set the {{ServiceWorkerRegistration/active}} attribute of registrationObject to the {{ServiceWorker}} object that represents registration’s active worker, or null if registration’s active worker is null.
                          @@ -3421,16 +3421,16 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                          1. Set worker's state to state.
                          2. -
                          3. Let workerObjects be an array containing all the ServiceWorker objects associated with worker.
                          4. +
                          5. Let workerObjects be an array containing all the {{ServiceWorker}} objects associated with worker.
                          6. For each workerObject in workerObjects:
                            1. Queue a task to run these substeps:
                                -
                              1. Set the state attribute of workerObject to the value (in {{ServiceWorkerState}} enumeration) corresponding to the first matching statement, switching on worker's state: +
                              2. Set the {{ServiceWorker/state}} attribute of workerObject to the value (in {{ServiceWorkerState}} enumeration) corresponding to the first matching statement, switching on worker's state:
                                installing
                                "installing" -

                                The service worker in this state is considered an installing worker. During this state, event.waitUntil(f) can be called inside the oninstall event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.

                                +

                                The service worker in this state is considered an installing worker. During this state, event.waitUntil(f) can be called inside the {{ServiceWorkerGlobalScope/oninstall}} event handler to extend the life of the installing worker until the passed promise resolves successfully. This is primarily used to ensure that the service worker is not active until all of the core caches are populated.

                                installed
                                "installed" @@ -3438,7 +3438,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                activating
                                "activating" -

                                The service worker in this state is considered an active worker. During this state, event.waitUntil(f) can be called inside the onactivate event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.

                                +

                                The service worker in this state is considered an active worker. During this state, event.waitUntil(f) can be called inside the {{ServiceWorkerGlobalScope/onactivate}} event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated.

                                activated
                                "activated" @@ -3469,7 +3469,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                                1. Assert: client is not null.
                                2. -
                                3. If client is a type of environment settings object, queue a task to fire an event named controllerchange at the ServiceWorkerContainer object client is associated with.
                                4. +
                                5. If client is a type of environment settings object, queue a task to fire an event named controllerchange at the {{ServiceWorkerContainer}} object client is associated with.

                                The task must use client's responsible event loop and the DOM manipulation task source.

                        @@ -3551,7 +3551,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                        1. Let clientObject be a new {{Client}} object.
                        2. -
                        3. Set clientObject's service worker client to client.
                        4. +
                        5. Set clientObject's service worker client to client.
                        6. Return clientObject.
                      @@ -3570,7 +3570,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
                      1. Let windowClient be a new {{WindowClient}} object.
                      2. -
                      3. Set windowClient's service worker client to client.
                      4. +
                      5. Set windowClient's service worker client to client.
                      6. Set windowClient's visibility state to visibilityState.
                      7. Set windowClient's focus state to focusState.
                      8. Set windowClient's ancestor origins array to ancestorOrigins.
                      9. diff --git a/docs/v1/index.html b/docs/v1/index.html index 85a578c0..16a8717b 100644 --- a/docs/v1/index.html +++ b/docs/v1/index.html @@ -1495,7 +1495,7 @@

                        Table of Contents

                        3 Client Context
                        1. - 3.1 ServiceWorker + 3.1 ServiceWorker
                          1. 3.1.1 scriptURL
                          2. 3.1.2 state @@ -1503,7 +1503,7 @@

                            Table of Contents

                          3. 3.1.4 Event handler
                        2. - 3.2 ServiceWorkerRegistration + 3.2 ServiceWorkerRegistration
                          1. 3.2.1 installing
                          2. 3.2.2 waiting @@ -1513,9 +1513,9 @@

                            Table of Contents

                          3. 3.2.6 unregister()
                          4. 3.2.7 Event handler
                          -
                        3. 3.3 navigator.serviceWorker +
                        4. 3.3 navigator.serviceWorker
                        5. - 3.4 ServiceWorkerContainer + 3.4 ServiceWorkerContainer
                          1. 3.4.1 controller
                          2. 3.4.2 ready @@ -1526,7 +1526,7 @@

                            Table of Contents

                          3. 3.4.7 Event handlers
                        6. - 3.5 ServiceWorkerMessageEvent + 3.5 ServiceWorkerMessageEvent
                          1. 3.5.1 event.data
                          2. 3.5.2 event.origin @@ -1540,7 +1540,7 @@

                            Table of Contents

                            4 Execution Context
                            1. - 4.1 ServiceWorkerGlobalScope + 4.1 ServiceWorkerGlobalScope
                              1. 4.1.1 clients
                              2. 4.1.2 registration @@ -1548,7 +1548,7 @@

                                Table of Contents

                              3. 4.1.4 Event handlers
                            2. - 4.2 Client + 4.2 Client
                              1. 4.2.1 url
                              2. 4.2.2 id @@ -1561,7 +1561,7 @@

                                Table of Contents

                              3. 4.2.9 navigate(url)
                            3. - 4.3 Clients + 4.3 Clients
                              1. 4.3.1 get(id)
                              2. 4.3.2 matchAll(options) @@ -1569,12 +1569,12 @@

                                Table of Contents

                              3. 4.3.4 claim()
                            4. - 4.4 ExtendableEvent + 4.4 ExtendableEvent
                              1. 4.4.1 event.waitUntil(f)
                            5. - 4.5 FetchEvent + 4.5 FetchEvent
                              1. 4.5.1 event.request
                              2. 4.5.2 event.clientId @@ -1584,7 +1584,7 @@

                                Table of Contents

                              3. 4.5.6 event.respondWith(r)
                            6. - 4.6 ExtendableMessageEvent + 4.6 ExtendableMessageEvent
                              1. 4.6.1 event.data
                              2. 4.6.2 event.origin @@ -1605,7 +1605,7 @@

                                Table of Contents

                              3. 5.3.1 caches
                            7. - 5.4 Cache + 5.4 Cache
                              1. 5.4.1 match(request, options)
                              2. 5.4.2 matchAll(request, options) @@ -1742,7 +1742,7 @@

                                A service worker has an associated set of event types to handle whose element type is an event listener’s event type. It is initially set to null.

                                2.1.1. Lifetime

                                -

                                The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker object.

                                +

                                The lifetime of a service worker is tied to the execution lifetime of events and not references held by service worker clients to the ServiceWorker object.

                                A user agent may terminate service workers at any time it:

                                @@ -1824,17 +1824,17 @@

                                3.1. ServiceWorker

                                +

                                3.1. ServiceWorker

                                [SecureContext, Exposed=(Window,Worker)]
                                -interface ServiceWorker : EventTarget {
                                -  readonly attribute USVString scriptURL;
                                -  readonly attribute ServiceWorkerState state;
                                -  void postMessage(any message, optional sequence<object> transfer = []);
                                +interface ServiceWorker : EventTarget {
                                +  readonly attribute USVString scriptURL;
                                +  readonly attribute ServiceWorkerState state;
                                +  void postMessage(any message, optional sequence<object> transfer = []);
                                 
                                   // event
                                -  attribute EventHandler onstatechange;
                                +  attribute EventHandler onstatechange;
                                 };
                                -ServiceWorker implements AbstractWorker;
                                +ServiceWorker implements AbstractWorker;
                                 
                                 enum ServiceWorkerState {
                                   "installing",
                                @@ -1844,11 +1844,11 @@ 

                                "redundant" };

                                -

                                A ServiceWorker object represents a service worker. Each ServiceWorker object is associated with a service worker. Multiple separate objects implementing the ServiceWorker interface across documents and workers can all be associated with the same service worker simultaneously.

                                -

                                A ServiceWorker object has an associated ServiceWorkerState object which is itself associated with service worker’s state.

                                +

                                A ServiceWorker object represents a service worker. Each ServiceWorker object is associated with a service worker. Multiple separate objects implementing the ServiceWorker interface across documents and workers can all be associated with the same service worker simultaneously.

                                +

                                A ServiceWorker object has an associated ServiceWorkerState object which is itself associated with service worker’s state.

                                -

                                3.1.1. scriptURL

                                -

                                The scriptURL attribute must return the service worker’s serialized script url.

                                +

                                3.1.1. scriptURL

                                +

                                The scriptURL attribute must return the service worker’s serialized script url.

                                For example, consider a document created by a navigation to https://example.com/app.html which matches via the following registration call which has been previously executed:

                                @@ -1859,17 +1859,17 @@

                                -

                                3.1.2. state

                                -

                                The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

                                +

                                3.1.2. state

                                +

                                The state attribute must return the value (in ServiceWorkerState enumeration) to which it was last set.

                                -

                                3.1.3. postMessage(message, transfer)

                                -

                                The postMessage(message, transfer) method must run these steps:

                                +

                                3.1.3. postMessage(message, transfer)

                                +

                                The postMessage(message, transfer) method must run these steps:

                                  -
                                1. If the state attribute value of the context object is "redundant", throw an "InvalidStateError" exception and abort these steps. +
                                2. If the state attribute value of the context object is "redundant", throw an "InvalidStateError" exception and abort these steps.
                                3. Let serviceWorker be the service worker represented by the context object.
                                4. Invoke Run Service Worker algorithm with serviceWorker as the argument. -
                                5. Let destination be the ServiceWorkerGlobalScope object associated with serviceWorker. +
                                6. Let destination be the ServiceWorkerGlobalScope object associated with serviceWorker.
                                7. Let targetRealm be destination’s Realm.
                                8. Let incumbentSettings be the incumbent settings object, and incumbentGlobal its global object.
                                9. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. @@ -1878,13 +1878,13 @@

                                  <
                                10. Queue a task that runs the following steps:
                                    -
                                  1. Create an event e that uses the ExtendableMessageEvent interface, with the event type message, which does not bubble and is not cancelable. -
                                  2. Let the data attribute of e be initialized to clonedMessage. -
                                  3. Let the origin attribute of e be initialized to the Unicode serialization of incumbentSettings’s origin. -
                                  4. If incumbentGlobal is a ServiceWorkerGlobalScope object, let the source attribute of e be initialized to a new ServiceWorker object that represents incumbentGlobal’s service worker. -
                                  5. Else if incumbentGlobal is a Window object, let the source attribute of e be initialized to a new WindowClient object that represents incumbentGlobal’s browsing context. -
                                  6. Else, let it be initialized to a new Client object that represents the worker associated with incumbentGlobal. -
                                  7. Let the ports attribute of e be initialized to newPorts. +
                                  8. Create an event e that uses the ExtendableMessageEvent interface, with the event type message, which does not bubble and is not cancelable. +
                                  9. Let the data attribute of e be initialized to clonedMessage. +
                                  10. Let the origin attribute of e be initialized to the Unicode serialization of incumbentSettings’s origin. +
                                  11. If incumbentGlobal is a ServiceWorkerGlobalScope object, let the source attribute of e be initialized to a new ServiceWorker object that represents incumbentGlobal’s service worker. +
                                  12. Else if incumbentGlobal is a Window object, let the source attribute of e be initialized to a new WindowClient object that represents incumbentGlobal’s browsing context. +
                                  13. Else, let it be initialized to a new Client object that represents the worker associated with incumbentGlobal. +
                                  14. Let the ports attribute of e be initialized to newPorts.
                                  15. Dispatch e at destination.

                                  The task must use the DOM manipulation task source.

                                  @@ -1892,7 +1892,7 @@

                                  <

                                3.1.4. Event handler

                                -

                                The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorker interface:

                                +

                                The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorker interface:

      install {{ExtendableEvent}}[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.)[Lifecycle event] The service worker's containing service worker registration's installing worker changes. (See step 11.2 of the Install algorithm.)
      activate {{ExtendableEvent}}[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.)[Lifecycle event] The service worker's containing service worker registration's active worker changes. (See step 12.2 of the Activate algorithm.)
      fetch {{FetchEvent}}[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)[Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)
      message
      @@ -1900,58 +1900,58 @@

      event handler event type

      -
      onstatechange - statechange + onstatechange + statechange
    -

    3.2. ServiceWorkerRegistration

    +

    3.2. ServiceWorkerRegistration

    [SecureContext, Exposed=(Window,Worker)]
    -interface ServiceWorkerRegistration : EventTarget {
    -  readonly attribute ServiceWorker? installing;
    -  readonly attribute ServiceWorker? waiting;
    -  readonly attribute ServiceWorker? active;
    +interface ServiceWorkerRegistration : EventTarget {
    +  readonly attribute ServiceWorker? installing;
    +  readonly attribute ServiceWorker? waiting;
    +  readonly attribute ServiceWorker? active;
     
    -  readonly attribute USVString scope;
    +  readonly attribute USVString scope;
     
    -  [NewObject] Promise<void> update();
    -  [NewObject] Promise<boolean> unregister();
    +  [NewObject] Promise<void> update();
    +  [NewObject] Promise<boolean> unregister();
     
       // event
    -  attribute EventHandler onupdatefound;
    +  attribute EventHandler onupdatefound;
     };
     
    -

    A ServiceWorkerRegistration object represents a service worker registration. Each ServiceWorkerRegistration object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration interface across documents and workers can all be associated with the same service worker registration simultaneously.

    +

    A ServiceWorkerRegistration object represents a service worker registration. Each ServiceWorkerRegistration object is associated with a service worker registration (a service worker registration). Multiple separate objects implementing the ServiceWorkerRegistration interface across documents and workers can all be associated with the same service worker registration simultaneously.

    - -

    installing attribute must return the value to which it was last set.

    -

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    + +

    installing attribute must return the value to which it was last set.

    +

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    - -

    waiting attribute must return the value to which it was last set.

    -

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    + +

    waiting attribute must return the value to which it was last set.

    +

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    - -

    active attribute must return the value to which it was last set.

    -

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    + +

    active attribute must return the value to which it was last set.

    +

    The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    -

    3.2.4. scope

    -

    The scope attribute must return service worker registration’s serialized scope url.

    +

    3.2.4. scope

    +

    The scope attribute must return service worker registration’s serialized scope url.

    In the example in section 3.1.1, the value of registration.scope, obtained from navigator.serviceWorker.ready.then(function(registration) { console.log(registration.scope); }) for example, will be "https://example.com/".

    -

    3.2.5. update()

    -

    update() method must run these steps:

    +

    3.2.5. update()

    +

    update() method must run these steps:

    1. Let p be a promise. -
    2. Let registration be the service worker registration. +
    3. Let registration be the service worker registration.
    4. Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.
    5. If newestWorker is null, reject p with an "InvalidStateError" exception and abort these steps. -
    6. If the context object’s relevant settings object’s global object globalObject is a ServiceWorkerGlobalScope object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError" exception and abort these steps. +
    7. If the context object’s relevant settings object’s global object globalObject is a ServiceWorkerGlobalScope object, and globalObject’s associated service worker’s state is installing, reject p with an "InvalidStateError" exception and abort these steps.
    8. Let job be the result of running Create Job with update, registration’s scope url, newestWorker’s script url, p, and the context object’s relevant settings object client.
    9. Set job’s worker type to newestWorker’s type.
    10. Invoke Schedule Job with job. @@ -1959,19 +1959,19 @@

      -

      -

      The unregister() method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister() method only affects subsequent navigations.

      -

      unregister() method must run these steps:

      + +

      The unregister() method unregisters the service worker registration. It is important to note that the currently controlled service worker client’s active service worker’s containing service worker registration is effective until all the service worker clients (including itself) using this service worker registration unload. That is, the unregister() method only affects subsequent navigations.

      +

      unregister() method must run these steps:

      1. Let p be a promise. -
      2. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object’s relevant settings object client. +
      3. Let job be the result of running Create Job with unregister, the scope url of the service worker registration, null, p, and the context object’s relevant settings object client.
      4. Invoke Schedule Job with job.
      5. Return p.

    3.2.7. Event handler

    -

    The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

    +

    The following is the event handler (and its corresponding event handler event type) that must be supported, as event handler IDL attributes, by all objects implementing ServiceWorkerRegistration interface:

    @@ -1979,68 +1979,68 @@ -
    onupdatefound + onupdatefound updatefound
    - +
    partial interface Navigator {
    -  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
    +  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
     };
     
     partial interface WorkerNavigator {
    -  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
    +  [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
     };
     
    -

    The serviceWorker attribute must return the ServiceWorkerContainer object that is associated with the context object.

    +

    The serviceWorker attribute must return the ServiceWorkerContainer object that is associated with the context object.

    -

    3.4. ServiceWorkerContainer

    +

    3.4. ServiceWorkerContainer

    [SecureContext, Exposed=(Window,Worker)]
    -interface ServiceWorkerContainer : EventTarget {
    -  readonly attribute ServiceWorker? controller;
    -  [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;
    +interface ServiceWorkerContainer : EventTarget {
    +  readonly attribute ServiceWorker? controller;
    +  [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready;
     
    -  [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
    +  [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options);
     
    -  [NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
    -  [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
    +  [NewObject] Promise<any> getRegistration(optional USVString clientURL = "");
    +  [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations();
     
    -  void startMessages();
    +  void startMessages();
     
     
       // events
    -  attribute EventHandler oncontrollerchange;
    -  attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
    +  attribute EventHandler oncontrollerchange;
    +  attribute EventHandler onmessage; // event.source of message events is ServiceWorker object
     };
     
    -
    dictionary RegistrationOptions {
    +
    dictionary RegistrationOptions {
       USVString scope;
       WorkerType type = "classic";
     };
     
    -

    The user agent must create a ServiceWorkerContainer object when a Navigator object or a WorkerNavigator object is created and associate it with that object.

    -

    A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

    -

    A ServiceWorkerContainer has an associated service worker client, which is a service worker client whose global object is associated with the Navigator object or the WorkerNavigator object that the ServiceWorkerContainer is retrieved from.

    -

    A ServiceWorkerContainer object has an associated ready promise (a promise). It is initially set to a new promise.

    -

    A ServiceWorkerContainer object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a ServiceWorkerContainer object’s client message queue is enabled, the event loop must use it as one of its task sources. When the ServiceWorkerContainer object’s relevant global object is a Window object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.

    +

    The user agent must create a ServiceWorkerContainer object when a Navigator object or a WorkerNavigator object is created and associate it with that object.

    +

    A ServiceWorkerContainer provides capabilities to register, unregister, and update the service worker registrations, and provides access to the state of the service worker registrations and their associated service workers.

    +

    A ServiceWorkerContainer has an associated service worker client, which is a service worker client whose global object is associated with the Navigator object or the WorkerNavigator object that the ServiceWorkerContainer is retrieved from.

    +

    A ServiceWorkerContainer object has an associated ready promise (a promise). It is initially set to a new promise.

    +

    A ServiceWorkerContainer object has a task source called the client message queue, initially empty. A client message queue can be enabled or disabled, and is initially disabled. When a ServiceWorkerContainer object’s client message queue is enabled, the event loop must use it as one of its task sources. When the ServiceWorkerContainer object’s relevant global object is a Window object, all tasks queued on its client message queue must be associated with its relevant settings object’s responsible document.

    - -

    controller attribute must run these steps:

    + +

    controller attribute must run these steps:

      -
    1. Let client be the context object’s service worker client. -
    2. Return the ServiceWorker object that represents client’s active service worker. +
    3. Let client be the context object’s service worker client. +
    4. Return the ServiceWorker object that represents client’s active service worker.
    -

    navigator.serviceWorker.controller returns null if the request is a force refresh (shift+refresh). The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    +

    navigator.serviceWorker.controller returns null if the request is a force refresh (shift+refresh). The ServiceWorker objects returned from this attribute getter that represent the same service worker are the same objects.

    - -

    ready attribute must run these steps:

    + +

    ready attribute must run these steps:

      -
    1. If the context object’s ready promise is settled, return the context object’s ready promise. -
    2. Let client be the context object’s service worker client. +
    3. If the context object’s ready promise is settled, return the context object’s ready promise. +
    4. Let client be the context object’s service worker client.
    5. Let registration be null.
    6. Let clientURL be client’s creation URL.
    7. @@ -2060,19 +2060,19 @@
    -
  • Return context object’s ready promise. +
  • Return context object’s ready promise. -

    When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

    +

    When the ready attribute is accessed, the returned promise will never reject. Instead, it waits until the promise resolves with a service worker registration that has an active worker.

  • - -

    The register(scriptURL, options) method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

    -

    register(scriptURL, options) method must run these steps:

    + +

    The register(scriptURL, options) method creates or updates a service worker registration for the given scope url. If successful, a service worker registration ties the provided scriptURL to a scope url, which is subsequently used for navigation matching.

    +

    register(scriptURL, options) method must run these steps:

    1. Let p be a promise. -
    2. Let client be the context object’s service worker client. +
    3. Let client be the context object’s service worker client.
    4. Let scriptURL be the result of parsing scriptURL with the context object’s relevant settings object’s API base URL.
    5. If scriptURL is failure, reject p with a TypeError and abort these steps.
    6. If scriptURL’s scheme is not one of "http" and "https", reject p with a TypeError and abort these steps. @@ -2091,10 +2091,10 @@ -

      getRegistration(clientURL) method must run these steps:

      + +

      getRegistration(clientURL) method must run these steps:

        -
      1. Let client be the context object’s service worker client. +
      2. Let client be the context object’s service worker client.
      3. Let clientURL be the result of parsing clientURL with the context object’s relevant settings object’s API base URL.
      4. If clientURL is failure, return a promise rejected with a TypeError.
      5. If the origin of clientURL is not client’s origin, return a promise rejected with a "SecurityError" exception. @@ -2106,7 +2106,7 @@
    7. Else: @@ -2118,10 +2118,10 @@ -

      getRegistrations() method must run these steps:

      + +

      getRegistrations() method must run these steps:

        -
      1. Let client be the context object’s service worker client. +
      2. Let client be the context object’s service worker client.
      3. Let promise be a new promise.
      4. Run the following substeps in parallel: @@ -2130,7 +2130,7 @@
      @@ -2138,12 +2138,12 @@ -

      startMessages() method must enable the context object’s client message queue if it is not enabled.

      + +

      startMessages() method must enable the context object’s client message queue if it is not enabled.

    3.4.7. Event handlers

    -

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

    +

    The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerContainer interface:

    @@ -2151,59 +2151,59 @@ - -
    oncontrollerchange + oncontrollerchange controllerchange
    onmessage + onmessage message
    -

    The first time the context object’s onmessage IDL attribute is set, its client message queue must be enabled.

    +

    The first time the context object’s onmessage IDL attribute is set, its client message queue must be enabled.

    -

    3.5. ServiceWorkerMessageEvent

    -
    [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
    -interface ServiceWorkerMessageEvent : Event {
    -  readonly attribute any data;
    -  readonly attribute USVString origin;
    -  readonly attribute DOMString lastEventId;
    -  [SameObject] readonly attribute (ServiceWorker or MessagePort)? source;
    -  readonly attribute FrozenArray<MessagePort> ports;
    +     

    3.5. ServiceWorkerMessageEvent

    +
    [Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)]
    +interface ServiceWorkerMessageEvent : Event {
    +  readonly attribute any data;
    +  readonly attribute USVString origin;
    +  readonly attribute DOMString lastEventId;
    +  [SameObject] readonly attribute (ServiceWorker or MessagePort)? source;
    +  readonly attribute FrozenArray<MessagePort> ports;
     };
     
    -
    dictionary ServiceWorkerMessageEventInit : EventInit {
    +
    dictionary ServiceWorkerMessageEventInit : EventInit {
       any data = null;
       USVString origin = "";
       DOMString lastEventId = "";
    -  (ServiceWorker or MessagePort)? source = null;
    +  (ServiceWorker or MessagePort)? source = null;
       sequence<MessagePort> ports = [];
     };
     
    -

    Service workers define the message event that extends the message event defined in [HTML] to allow setting a ServiceWorker object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

    +

    Service workers define the message event that extends the message event defined in [HTML] to allow setting a ServiceWorker object as the source of the message. For the message event, service workers use the ServiceWorkerMessageEvent interface.

    -

    3.5.1. event.data

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    3.5.1. event.data

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    -

    3.5.2. event.origin

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.

    +

    3.5.2. event.origin

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker’s environment settings object from which the message is sent.

    -

    3.5.3. event.lastEventId

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    3.5.3. event.lastEventId

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    -

    3.5.4. event.source

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

    +

    3.5.4. event.source

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the ServiceWorker object whose associated service worker the message is sent from.

    -

    3.5.5. event.ports

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    +

    3.5.5. event.ports

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    3.6. Events

    -

    The following event is dispatched on ServiceWorker object:

    +

    The following event is dispatched on ServiceWorker object:

    @@ -2212,11 +2212,11 @@

    Dispatched when…

    -
    statechange + statechange Event - The state attribute of the ServiceWorker object is changed. + The state attribute of the ServiceWorker object is changed.
    -

    The following event is dispatched on ServiceWorkerRegistration object:

    +

    The following event is dispatched on ServiceWorkerRegistration object:

    @@ -2227,9 +2227,9 @@

    updatefound Event - The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.) + The service worker registration’s installing worker changes. (See step 8 of the Install algorithm.)
    -

    The following events are dispatched on ServiceWorkerContainer object:

    +

    The following events are dispatched on ServiceWorkerContainer object:

    @@ -2240,10 +2240,10 @@

    controllerchange Event - The service worker client’s active service worker changes. (See step 9.2 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.) + The service worker client’s active service worker changes. (See step 9.2 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.)
    message - ServiceWorkerMessageEvent + ServiceWorkerMessageEvent When it receives a message.
    @@ -2287,38 +2287,38 @@

    4.1. ServiceWorkerGlobalScope

    -
    [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
    -interface ServiceWorkerGlobalScope : WorkerGlobalScope {
    +     

    4.1. ServiceWorkerGlobalScope

    +
    [Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
    +interface ServiceWorkerGlobalScope : WorkerGlobalScope {
       // A container for a list of Client objects that correspond to
       // browsing contexts (or shared workers) that are on the origin of this SW
    -  [SameObject] readonly attribute Clients clients;
    -  [SameObject] readonly attribute ServiceWorkerRegistration registration;
    +  [SameObject] readonly attribute Clients clients;
    +  [SameObject] readonly attribute ServiceWorkerRegistration registration;
     
    -  [NewObject] Promise<void> skipWaiting();
    +  [NewObject] Promise<void> skipWaiting();
     
    -  attribute EventHandler oninstall;
    -  attribute EventHandler onactivate;
    -  attribute EventHandler onfetch;
    +  attribute EventHandler oninstall;
    +  attribute EventHandler onactivate;
    +  attribute EventHandler onfetch;
     
       // event
    -  attribute EventHandler onmessage; // event.source of the message events is Client object
    +  attribute EventHandler onmessage; // event.source of the message events is Client object
     };
     
    -

    A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A ServiceWorkerGlobalScope object has an associated service worker (a service worker).

    -

    ServiceWorkerGlobalScope object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

    +

    A ServiceWorkerGlobalScope object represents the global execution context of a service worker. A ServiceWorkerGlobalScope object has an associated service worker (a service worker).

    +

    ServiceWorkerGlobalScope object provides generic, event-driven, time-limited script execution contexts that run at an origin. Once successfully registered, a service worker is started, kept alive and killed by their relationship to events, not service worker clients. Any type of synchronous requests must not be initiated inside of a service worker.

    -

    4.1.1. clients

    -

    clients attribute must return the Clients object that is associated with the context object.

    +

    4.1.1. clients

    +

    clients attribute must return the Clients object that is associated with the context object.

    -

    4.1.2. registration

    -

    The registration attribute must return the ServiceWorkerRegistration object that represents the service worker’s containing service worker registration.

    +

    4.1.2. registration

    +

    The registration attribute must return the ServiceWorkerRegistration object that represents the service worker’s containing service worker registration.

    -

    4.1.3. skipWaiting()

    -

    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:

    +

    4.1.3. skipWaiting()

    +

    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:

    1. Let promise be a new promise.
    2. @@ -2337,7 +2337,7 @@

      4.1.4. Event handlers

      -

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

      +

      The following are the event handlers (and their corresponding event handler event types) that must be supported, as event handler IDL attributes, by all objects implementing the ServiceWorkerGlobalScope interface:

      @@ -2345,62 +2345,62 @@ - - - -
      oninstall + oninstall install
      onactivate + onactivate activate
      onfetch + onfetch fetch
      onmessage + onmessage message
    -

    4.2. Client

    +

    4.2. Client

    [Exposed=ServiceWorker]
    -interface Client {
    -  readonly attribute USVString url;
    -  readonly attribute DOMString id;
    -  readonly attribute boolean reserved;
    -  void postMessage(any message, optional sequence<object> transfer);
    +interface Client {
    +  readonly attribute USVString url;
    +  readonly attribute DOMString id;
    +  readonly attribute boolean reserved;
    +  void postMessage(any message, optional sequence<object> transfer);
     };
     
     [Exposed=ServiceWorker]
    -interface WindowClient : Client {
    -  readonly attribute VisibilityState visibilityState;
    -  readonly attribute boolean focused;
    -  [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins;
    -  [NewObject] Promise<WindowClient> focus();
    -  [NewObject] Promise<WindowClient> navigate(USVString url);
    +interface WindowClient : Client {
    +  readonly attribute VisibilityState visibilityState;
    +  readonly attribute boolean focused;
    +  [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins;
    +  [NewObject] Promise<WindowClient> focus();
    +  [NewObject] Promise<WindowClient> navigate(USVString url);
     };
     
    -

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

    +

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

    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).

    A WindowClient object has an associated ancestor origins array.

    -

    4.2.1. url

    -

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

    +

    4.2.1. url

    +

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

    -

    4.2.2. id

    -

    The id attribute must return its associated service worker client’s id.

    +

    4.2.2. id

    +

    The id attribute must return its associated service worker client’s id.

    -

    4.2.3. reserved

    -

    The reserved attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.

    +

    4.2.3. reserved

    +

    The reserved attribute must return true if the context object’s associated service worker client’s execution ready flag is unset, and false otherwise.

    Defining the execution ready flag is a work in progress. See the pull request to HTML.

    -

    4.2.4. postMessage(message, transfer)

    -

    The postMessage(message, transfer) method must run these steps:

    +

    4.2.4. postMessage(message, transfer)

    +

    The postMessage(message, transfer) method must run these steps:

    1. Let sourceSettings be the context object’s relevant settings object. -
    2. Let destination be the ServiceWorkerContainer object whose service worker client is the context object’s service worker client. +
    3. Let destination be the ServiceWorkerContainer object whose service worker client is the context object’s service worker client.
    4. If destination is null, throw an "InvalidStateError" exception.
    5. Let targetRealm be destination’s relevant Realm.
    6. Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. @@ -2409,42 +2409,42 @@

      Add a task that runs the following steps to destination’s client message queue:
        -
      1. Create an event e that uses the ServiceWorkerMessageEvent interface, with the event type message, which does not bubble and is not cancelable. -
      2. Let the data attribute of e be initialized to clonedMessage. -
      3. Let the origin attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. -
      4. Let the source attribute of e be initialized to a ServiceWorker object, which represents the service worker associated with sourceSettings’s global object. -
      5. Let the ports attribute of e be initialized to newPorts. +
      6. Create an event e that uses the ServiceWorkerMessageEvent interface, with the event type message, which does not bubble and is not cancelable. +
      7. Let the data attribute of e be initialized to clonedMessage. +
      8. Let the origin attribute of e be initialized to the Unicode serialization of sourceSettings’s origin. +
      9. Let the source attribute of e be initialized to a ServiceWorker object, which represents the service worker associated with sourceSettings’s global object. +
      10. Let the ports attribute of e be initialized to newPorts.
      11. Dispatch e at destination.

    -

    4.2.5. visibilityState

    -

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

    +

    4.2.5. visibilityState

    +

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

    -

    4.2.6. focused

    -

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

    +

    4.2.6. focused

    +

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

    -

    4.2.7. ancestorOrigins

    -

    The ancestorOrigins attribute must return the context object’s associated service worker client’s ancestor origins array.

    +

    4.2.7. ancestorOrigins

    +

    The ancestorOrigins attribute must return the context object’s associated service worker client’s ancestor origins array.

    -

    4.2.8. focus()

    -

    The focus() method must run these steps:

    +

    4.2.8. focus()

    +

    The focus() method must run these steps:

    1. If this algorithm is not triggered by user activation, return a promise rejected with an "InvalidAccessError" exception.
    2. Let promise be a new promise.
    3. Run these substeps in parallel:
        -
      1. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
      2. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
      3. Let visibilityState be null.
      4. Let focusState be false.
      5. Let ancestorOrigins be the empty array.
      6. - Queue a task 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: + Queue a task 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. Set visibilityState to browsingContext’s active document’s visibilityState attribute value. @@ -2452,7 +2452,7 @@

          active document’s relevant global object’s Location object’s ancestor origins array.

      7. Wait for task to have executed. -
      8. Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments. +
      9. Let windowClient be the result of running Create Window Client algorithm with the context object’s associated service worker client, visibilityState, focusState, and ancestorOrigins as the arguments.
      10. If windowClient’s focus state is true, resolve promise with windowClient.
      11. Else, reject promise with a TypeError.
      @@ -2460,25 +2460,25 @@

      -

      4.2.9. navigate(url)

      -

      The navigate() method must run these steps:

      +

      4.2.9. navigate(url)

      +

      The navigate() method must run these steps:

      1. Let url be the result of parsing url with the context object’s relevant settings object’s API base URL.
      2. If url is failure, return a promise rejected with a TypeError.
      3. If url is about:blank, return a promise rejected with a TypeError. -
      4. If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a TypeError. +
      5. If the context object’s associated service worker client’s active service worker is not the context object’s relevant global object’s service worker, return a promise rejected with a TypeError.
      6. Let promise be a new promise.
      7. Run these substeps in parallel:
          -
        1. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context. +
        2. Let browsingContext be the context object’s associated service worker client’s global object’s browsing context.
        3. If browsingContext has discarded its Document, reject promise with a TypeError and abort these steps.
        4. Let navigateFailed to false.
        5. Let visibilityState be null.
        6. Let focusState be false.
        7. Let ancestorOrigins be the empty array.
        8. - Queue a task 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: + Queue a task 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. HandleNavigate: Navigate browsingContext to url with exceptions enabled. The source browsing context must be browsingContext.
          2. If the algorithm steps invoked in the step labeled HandleNavigate throws an exception, set navigateFailed to true. @@ -2489,7 +2489,7 @@

            Wait for task to have executed (including its asynchronous steps).
          3. If navigateFailed is true, reject promise with a TypeError and abort these steps.
          4. - If browsingContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then: + If browsingContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then:
            1. Resolve promise with null.
            2. Abort these steps. @@ -2502,40 +2502,40 @@

    -

    4.3. Clients

    +

    4.3. Clients

    [Exposed=ServiceWorker]
    -interface Clients {
    +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();
    +  [NewObject] Promise<any> get(DOMString id);
    +  [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
    +  [NewObject] Promise<WindowClient?> openWindow(USVString url);
    +  [NewObject] Promise<void> claim();
     };
     
    -
    dictionary ClientQueryOptions {
    +
    dictionary ClientQueryOptions {
       boolean includeUncontrolled = false;
       boolean includeReserved = false;
    -  ClientType type = "window";
    +  ClientType type = "window";
     };
     
    -
    enum ClientType {
    +
    enum ClientType {
       "window",
       "worker",
       "sharedworker",
       "all"
     };
     
    -

    The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

    +

    The user agent must create a Clients object when a ServiceWorkerGlobalScope object is created and associate it with that object.

    -

    4.3.1. get(id)

    -

    The get(id) method must run these steps:

    +

    4.3.1. get(id)

    +

    The get(id) method must run these steps:

    1. Let promise be a new promise.
    2. Run these substeps in parallel:
      1. - For each service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
        1. If client’s id is not id, continue to the next iteration of the loop.
        2. @@ -2581,8 +2581,8 @@

          -

          4.3.2. matchAll(options)

          -

          The matchAll(options) method must run these steps:

          +

          4.3.2. matchAll(options)

          +

          The matchAll(options) method must run these steps:

          1. Let promise be a new promise.
          2. @@ -2590,7 +2590,7 @@

            service worker client client whose origin is the same as the associated service worker’s origin: + For each service worker client client whose origin is the same as the associated service worker’s origin:
            1. If client is a type of environment, then: @@ -2605,7 +2605,7 @@

              includeUncontrolled is false, then:
                -
              1. If client’s active service worker is not the associated service worker, continue to the next iteration of the loop. +
              2. If client’s active service worker is not the associated service worker, continue to the next iteration of the loop.
            2. If options.includeReserved is false, then: @@ -2660,8 +2660,8 @@

              -

              4.3.3. openWindow(url)

              -

              The openWindow(url) method must run these steps:

              +

              4.3.3. openWindow(url)

              +

              The openWindow(url) method must run these steps:

              1. Let url be the result of parsing url with the context object’s relevant settings object’s API base URL.
              2. If url is failure, return a promise rejected with a TypeError. @@ -2688,7 +2688,7 @@

                Wait for task to have executed (including its asynchronous steps).
              3. If openWindowFailed is true, reject promise with a TypeError and abort these steps.
              4. - If newContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then: + If newContext’s Window object’s environment settings object’s creation URL’s origin is not the same as the service worker’s origin, then:
                1. Resolve promise with null.
                2. Abort these steps. @@ -2700,16 +2700,16 @@

    -

    4.3.4. claim()

    -

    The claim() method must run these steps:

    +

    4.3.4. claim()

    +

    The claim() method must run these steps:

      -
    1. If the service worker is not an active worker, return a promise rejected with an "InvalidStateError" exception. +
    2. If the service worker is not an active worker, return a promise rejected with an "InvalidStateError" exception.
    3. Let promise be a new promise.
    4. Run the following substeps in parallel:
      1. - For each service worker client client whose origin is the same as the service worker’s origin: + For each service worker client client whose origin is the same as the service worker’s origin:
        1. If client is a type of environment, then: @@ -2722,12 +2722,12 @@

          secure context, continue to the next iteration of the loop.

      2. Let registration be the result of running Match Service Worker Registration algorithm passing client’s creation URL as the argument. -
      3. If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop. +
      4. If registration is not the service worker’s containing service worker registration, continue to the next iteration of the loop.
      5. - If client’s active service worker is not the service worker, then: + If client’s active service worker is not the service worker, then:
        1. Invoke Handle Service Worker Client Unload with client as the argument. -
        2. Set client’s active service worker to service worker. +
        3. Set client’s active service worker to service worker.
        4. Invoke Notify Controller Change algorithm with client as the argument.
      @@ -2738,38 +2738,38 @@

      4.4. ExtendableEvent

      +

      4.4. ExtendableEvent

      [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker]
      -interface ExtendableEvent : Event {
      -  void waitUntil(Promise<any> f);
      +interface ExtendableEvent : Event {
      +  void waitUntil(Promise<any> f);
       };
       
      dictionary ExtendableEventInit : EventInit {
         // Defined for the forward compatibility across the derived events
       };
       
      -

      An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

      -

      An ExtendableEvent object has an associated extensions allowed flag. It is initially set.

      -

      Service workers have two lifecycle events, install and activate. Service workers use the ExtendableEvent interface for activate event and install event.

      -

      Service worker extensions that define event handlers may also use or extend the ExtendableEvent interface.

      -

      When dispatching an event e that uses the ExtendableEvent interface, the user agent must run these steps:

      +

      An ExtendableEvent object has an associated extend lifetime promises (an array of promises). It is initially an empty array.

      +

      An ExtendableEvent object has an associated extensions allowed flag. It is initially set.

      +

      Service workers have two lifecycle events, install and activate. Service workers use the ExtendableEvent interface for activate event and install event.

      +

      Service worker extensions that define event handlers may also use or extend the ExtendableEvent interface.

      +

      When dispatching an event e that uses the ExtendableEvent interface, the user agent must run these steps:

        -
      1. If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps. +
      2. If e’s extend lifetime promises is empty, unset e’s extensions allowed flag and abort these steps.
      3. Let extendLifetimePromises be an empty array.
      4. Run the following substeps in parallel:
          -
        1. SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises. +
        2. SetupPromiseArray: Set extendLifetimePromises to a copy of e’s extend lifetime promises.
        3. Wait until all the promises in extendLifetimePromises settle. -
        4. If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray. +
        5. If the length of extendLifetimePromises does not equal the length of e’s extend lifetime promises, jump to the step labeled SetupPromiseArray.
        6. Unset e’s extensions allowed flag.

      The user agent should not terminate the service worker associated with e’s relevant settings object’s global object until e’s extensions allowed flag is unset. However, the user agent may impose a time limit to this lifetime extension.

      -

      4.4.1. event.waitUntil(f)

      -

      waitUntil(f) method extends the lifetime of the event.

      -

      waitUntil(f) method must run these steps:

      +

      4.4.1. event.waitUntil(f)

      +

      waitUntil(f) method extends the lifetime of the event.

      +

      waitUntil(f) method must run these steps:

      1. If the extensions allowed flag is unset, then: @@ -2777,30 +2777,30 @@

        Throw an "InvalidStateError" exception.
      2. Abort these steps.
      -
    5. Add f to the extend lifetime promises. +
    6. Add f to the extend lifetime promises.
    -

    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

    +

    Service workers and extensions that define event handlers may define their own behaviors, allowing the extend lifetime promises to suggest operation length, and the rejected state of any of the promise in extend lifetime promises to suggest operation failure.

    Service workers define the following behaviors for install event and activate event, respectively:

    -

    4.5. FetchEvent

    -
    [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
    -interface FetchEvent : ExtendableEvent {
    -  [SameObject] readonly attribute Request request;
    -  readonly attribute DOMString clientId;
    -  readonly attribute DOMString reservedClientId;
    -  readonly attribute DOMString targetClientId;
    -  readonly attribute boolean isReload;
    -
    -  void respondWith(Promise<Response> r);
    +     

    4.5. FetchEvent

    +
    [Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker]
    +interface FetchEvent : ExtendableEvent {
    +  [SameObject] readonly attribute Request request;
    +  readonly attribute DOMString clientId;
    +  readonly attribute DOMString reservedClientId;
    +  readonly attribute DOMString targetClientId;
    +  readonly attribute boolean isReload;
    +
    +  void respondWith(Promise<Response> r);
     };
     
    -
    dictionary FetchEventInit : ExtendableEventInit {
    +
    dictionary FetchEventInit : ExtendableEventInit {
       required Request request;
       DOMString clientId = null;
       DOMString reservedClientId = "";
    @@ -2808,39 +2808,39 @@ 

    boolean isReload = false; };

    -

    Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the ExtendableEvent interface.

    -

    Each event using FetchEvent interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

    +

    Service workers have an essential functional event fetch. For fetch event, service workers use the FetchEvent interface which extends the ExtendableEvent interface.

    +

    Each event using FetchEvent interface has an associated potential response (a response), initially set to null, and the following associated flags that are initially unset:

      -
    • wait to respond flag -
    • respond-with entered flag -
    • respond-with error flag +
    • wait to respond flag +
    • respond-with entered flag +
    • respond-with error flag

    -

    4.5.1. event.request

    -

    request attribute must return the value it was initialized to.

    +

    4.5.1. event.request

    +

    request attribute must return the value it was initialized to.

    -

    4.5.2. event.clientId

    -

    clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.5.2. event.clientId

    +

    clientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.5.3. event.reservedClientId

    -

    reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.5.3. event.reservedClientId

    +

    reservedClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.5.4. event.targetClientId

    -

    targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    +

    4.5.4. event.targetClientId

    +

    targetClientId attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the empty string.

    -

    4.5.5. event.isReload

    -

    isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

    +

    4.5.5. event.isReload

    +

    isReload attribute must return the value it was initialized to. When an event is created the attribute must be initialized to false.

    Pressing the refresh button should be considered a reload while clicking a link and pressing the back button should not. The behavior of the Ctrl+l enter is left to the implementations of the user agents.

    -

    4.5.6. event.respondWith(r)

    +

    4.5.6. event.respondWith(r)

    Developers can set the argument r with either a promise that resolves with a Response object or a Response object (which is automatically cast to a promise). Otherwise, a network error is returned to Fetch. Renderer-side security checks about tainting for cross-origin content are tied to the types of filtered responses defined in Fetch.

    -

    respondWith(r) method must run these steps:

    +

    respondWith(r) method must run these steps:

    1. If the dispatch flag is unset, then: @@ -2855,8 +2855,8 @@

      Abort these steps.

  • - Add r to the extend lifetime promises. -

    event.respondWith(r) extends the lifetime of the event by default as if event.waitUntil(r) is called.

    + Add r to the extend lifetime promises. +

    event.respondWith(r) extends the lifetime of the event by default as if event.waitUntil(r) is called.

  • Set the stop propagation flag and stop immediate propagation flag.
  • Set the respond-with entered flag.
  • Set the wait to respond flag. @@ -2919,7 +2919,7 @@

    These substeps are meant to produce the observable equivalent of "piping" response’s body’s stream into potentialResponse.

    -
  • Set the potential response to potentialResponse. +
  • Set the potential response to potentialResponse.
  • @@ -2935,49 +2935,49 @@

  • -

    4.6. ExtendableMessageEvent

    -
    [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
    -interface ExtendableMessageEvent : ExtendableEvent {
    -  readonly attribute any data;
    -  readonly attribute USVString origin;
    -  readonly attribute DOMString lastEventId;
    -  [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
    -  readonly attribute FrozenArray<MessagePort> ports;
    +     

    4.6. ExtendableMessageEvent

    +
    [Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker]
    +interface ExtendableMessageEvent : ExtendableEvent {
    +  readonly attribute any data;
    +  readonly attribute USVString origin;
    +  readonly attribute DOMString lastEventId;
    +  [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source;
    +  readonly attribute FrozenArray<MessagePort> ports;
     };
     
    -
    dictionary ExtendableMessageEventInit : ExtendableEventInit {
    +
    dictionary ExtendableMessageEventInit : ExtendableEventInit {
       any data = null;
       USVString origin = "";
       DOMString lastEventId = "";
    -  (Client or ServiceWorker or MessagePort)? source = null;
    +  (Client or ServiceWorker or MessagePort)? source = null;
       sequence<MessagePort> ports = [];
     };
     
    -

    Service workers define the extendable message event that extends the message event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the ExtendableEvent interface.

    +

    Service workers define the extendable message event that extends the message event defined in [HTML] to allow extending the lifetime of the event. For the message event, service workers use the ExtendableMessageEvent interface which extends the ExtendableEvent interface.

    -

    4.6.1. event.data

    -

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    +

    4.6.1. event.data

    +

    The data attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the message being sent.

    -

    4.6.2. event.origin

    -

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    +

    4.6.2. event.origin

    +

    The origin attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string. It represents the origin of the service worker client that sent the message.

    -

    4.6.3. event.lastEventId

    -

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    +

    4.6.3. event.lastEventId

    +

    The lastEventId attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty string.

    -

    4.6.4. event.source

    -

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the Client object from which the message is sent.

    +

    4.6.4. event.source

    +

    The source attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to null. It represents the Client object from which the message is sent.

    -

    4.6.5. event.ports

    -

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    +

    4.6.5. event.ports

    +

    The ports attribute must return the value it was initialized to. When the object is created, this attribute must be initialized to the empty array. It represents the MessagePort array being sent.

    4.7. Events

    -

    The following events are dispatched on ServiceWorkerGlobalScope object:

    +

    The following events are dispatched on ServiceWorkerGlobalScope object:

    @@ -2987,87 +2987,87 @@

    install - ExtendableEvent - [Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.) + ExtendableEvent + [Lifecycle event] The service worker’s containing service worker registration’s installing worker changes. (See step 11.2 of the Install algorithm.)
    activate - ExtendableEvent - [Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.) + ExtendableEvent + [Lifecycle event] The service worker’s containing service worker registration’s active worker changes. (See step 12.2 of the Activate algorithm.)
    fetch - FetchEvent - [Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.) + FetchEvent + [Functional event] The http fetch invokes Handle Fetch with request. As a result of performing Handle Fetch, the service worker returns a response to the http fetch. The response, represented by a Response object, can be retrieved from a Cache object or directly from network using self.fetch(input, init) method. (A custom Response object can be another option.)
    message - ExtendableMessageEvent + ExtendableMessageEvent When it receives a message.

    5. Caches

    -

    To allow authors to fully manage their content caches for offline use, the Window and the WorkerGlobalScope provide the asynchronous caching methods that open and manipulate Cache objects. An origin can have multiple, named Cache objects, whose contents are entirely under the control of scripts. Caches are not shared across origins, and they are completely isolated from the browser’s HTTP cache.

    +

    To allow authors to fully manage their content caches for offline use, the Window and the WorkerGlobalScope provide the asynchronous caching methods that open and manipulate Cache objects. An origin can have multiple, named Cache objects, whose contents are entirely under the control of scripts. Caches are not shared across origins, and they are completely isolated from the browser’s HTTP cache.

    5.1. Constructs

    A fetching record is a Record {[[key]], [[value]]} where [[key]] is a Request and [[value]] is a Response.

    A fetching record has an associated incumbent record (a fetching record). It is initially set to null.

    A request to response map is a List of fetching records.

    -

    A name to cache map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a name of the Cache object and [[value]] is a Cache object.

    +

    A name to cache map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a name of the Cache object and [[value]] is a Cache object.

    Each origin has an associated name to cache map.

    5.2. Understanding Cache Lifetimes

    -

    The Cache instances are not part of the browser’s HTTP cache. The Cache objects are exactly what authors have to manage themselves. The Cache objects do not get updated unless authors explicitly request them to be. The Cache objects do not expire unless authors delete the entries. The Cache objects do not disappear just because the service worker script is updated. That is, caches are not updated automatically. Updates must be manually managed. This implies that authors should version their caches by name and make sure to use the caches only from the version of the service worker that can safely operate on.

    +

    The Cache instances are not part of the browser’s HTTP cache. The Cache objects are exactly what authors have to manage themselves. The Cache objects do not get updated unless authors explicitly request them to be. The Cache objects do not expire unless authors delete the entries. The Cache objects do not disappear just because the service worker script is updated. That is, caches are not updated automatically. Updates must be manually managed. This implies that authors should version their caches by name and make sure to use the caches only from the version of the service worker that can safely operate on.

    5.3. self.caches

    partial interface WindowOrWorkerGlobalScope {
    -  [SecureContext, SameObject] readonly attribute CacheStorage caches;
    +  [SecureContext, SameObject] readonly attribute CacheStorage caches;
     };
     

    5.3.1. caches

    -

    caches attribute must return this object’s associated CacheStorage object.

    +

    caches attribute must return this object’s associated CacheStorage object.

    -

    5.4. Cache

    +

    5.4. Cache

    [SecureContext, Exposed=(Window,Worker)]
    -interface Cache {
    -  [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
    -  [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
    -  [NewObject] Promise<void> add(RequestInfo request);
    -  [NewObject] Promise<void> addAll(sequence<RequestInfo> requests);
    -  [NewObject] Promise<void> put(RequestInfo request, Response response);
    -  [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options);
    -  [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options);
    +interface Cache {
    +  [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
    +  [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options);
    +  [NewObject] Promise<void> add(RequestInfo request);
    +  [NewObject] Promise<void> addAll(sequence<RequestInfo> requests);
    +  [NewObject] Promise<void> put(RequestInfo request, Response response);
    +  [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options);
    +  [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options);
     };
     
    -
    dictionary CacheQueryOptions {
    +
    dictionary CacheQueryOptions {
       boolean ignoreSearch = false;
       boolean ignoreMethod = false;
       boolean ignoreVary = false;
       DOMString cacheName;
     };
     
    -
    dictionary CacheBatchOperation {
    +
    dictionary CacheBatchOperation {
       DOMString type;
       Request request;
       Response response;
    -  CacheQueryOptions options;
    +  CacheQueryOptions options;
     };
     
    -

    A Cache object represents a request to response map. Multiple separate objects implementing the Cache interface across documents and workers can all be associated with the same request to response map simultaneously.

    -

    Cache objects are always enumerable via self.caches in insertion order (per ECMAScript 6 Map objects).

    +

    A Cache object represents a request to response map. Multiple separate objects implementing the Cache interface across documents and workers can all be associated with the same request to response map simultaneously.

    +

    Cache objects are always enumerable via self.caches in insertion order (per ECMAScript 6 Map objects).

    -

    5.4.1. match(request, options)

    -

    match(request, options) method must run these steps:

    +

    5.4.1. match(request, options)

    +

    match(request, options) method must run these steps:

    1. Let promise be a new promise.
    2. Run these substeps in parallel:
        -
      1. Let p be the result of running the algorithm specified in matchAll(request, options) method with request and options as the arguments. +
      2. Let p be the result of running the algorithm specified in matchAll(request, options) method with request and options as the arguments.
      3. Wait until p settles.
      4. If p rejects with an exception, then: @@ -3093,8 +3093,8 @@

        -

        5.4.2. matchAll(request, options)

        -

        matchAll(request, options) method must run these steps:

        +

        5.4.2. matchAll(request, options)

        +

        matchAll(request, options) method must run these steps:

        1. Let r be null.
        2. @@ -3147,17 +3147,17 @@

          -

          5.4.3. add(request)

          -

          add(request) method must run these steps:

          +

          5.4.3. add(request)

          +

          add(request) method must run these steps:

          1. Let requests be an array containing only request. -
          2. Set responseArrayPromise to the result of running the algorithm specified in addAll(requests) passing requests as the argument. +
          3. Set responseArrayPromise to the result of running the algorithm specified in addAll(requests) passing requests as the argument.
          4. Return the result of transforming responseArrayPromise with a fulfillment handler that returns undefined.

    -

    5.4.4. addAll(requests)

    -

    addAll(requests) method must run these steps:

    +

    5.4.4. addAll(requests)

    +

    addAll(requests) method must run these steps:

    1. Let responsePromiseArray be an empty array.
    2. Let requestArray be an empty array. @@ -3217,7 +3217,7 @@

      CacheBatchOperation dictionary. +
    3. Let o be an empty object representing a CacheBatchOperation dictionary.
    4. Set the type dictionary member of o to "put".
    5. Set the request dictionary member of o to requestArray[index].
    6. Set the response dictionary member of o to response. @@ -3273,8 +3273,8 @@

      -

      5.4.5. put(request, response)

      -

      put(request, response) method must run these steps:

      +

      5.4.5. put(request, response)

      +

      put(request, response) method must run these steps:

      1. Let r be null.
      2. @@ -3310,7 +3310,7 @@

        Read all bytes from dummyStream with reader.

    7. Let operations be an empty array. -
    8. Let o be an empty object representing a CacheBatchOperation dictionary. +
    9. Let o be an empty object representing a CacheBatchOperation dictionary.
    10. Set the type dictionary member of o to "put".
    11. Set the request dictionary member of o to a Request object associated with r.
    12. Set the response dictionary member of o to newResponse. @@ -3351,8 +3351,8 @@

      -

      5.4.6. delete(request, options)

      -

      delete(request, options) method must run these steps:

      +

      5.4.6. delete(request, options)

      +

      delete(request, options) method must run these steps:

      1. Let r be null.
      2. @@ -3367,7 +3367,7 @@

        request of the result of invoking the initial value of Request as constructor with request as its argument. If this throws an exception, return a promise rejected with that exception.

    13. Let operations be an empty array. -
    14. Let o be an empty object representing a CacheBatchOperation dictionary. +
    15. Let o be an empty object representing a CacheBatchOperation dictionary.
    16. Set the type dictionary member of o to "delete".
    17. Set the request dictionary member of o to a Request object associated with r.
    18. Set the options dictionary member of o to options. @@ -3382,8 +3382,8 @@

      -

      5.4.7. keys(request, options)

      -

      keys(request, options) method must run these steps:

      +

      5.4.7. keys(request, options)

      +

      keys(request, options) method must run these steps:

      1. Let promise be a new promise.
      2. @@ -3428,22 +3428,22 @@

        5.5. CacheStorage

        +

        5.5. CacheStorage

        [SecureContext, Exposed=(Window,Worker)]
        -interface CacheStorage {
        -  [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
        -  [NewObject] Promise<boolean> has(DOMString cacheName);
        -  [NewObject] Promise<Cache> open(DOMString cacheName);
        -  [NewObject] Promise<boolean> delete(DOMString cacheName);
        -  [NewObject] Promise<sequence<DOMString>> keys();
        +interface CacheStorage {
        +  [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options);
        +  [NewObject] Promise<boolean> has(DOMString cacheName);
        +  [NewObject] Promise<Cache> open(DOMString cacheName);
        +  [NewObject] Promise<boolean> delete(DOMString cacheName);
        +  [NewObject] Promise<sequence<DOMString>> keys();
         };
         
        -

        CacheStorage interface is designed to largely conform to ECMAScript 6 Map objects but entirely async, and with additional convenience methods. The methods, clear, forEach, entries and values, are intentionally excluded from the scope of the first version resorting to the ongoing discussion about the async iteration by TC39.

        -

        The user agent must create a CacheStorage object when a Window object or a WorkerGlobalScope object is created and associate it with that global object.

        -

        A CacheStorage object represents a name to cache map of its associated global object’s environment settings object’s origin. Multiple separate objects implementing the CacheStorage interface across documents and workers can all be associated with the same name to cache map simultaneously.

        +

        CacheStorage interface is designed to largely conform to ECMAScript 6 Map objects but entirely async, and with additional convenience methods. The methods, clear, forEach, entries and values, are intentionally excluded from the scope of the first version resorting to the ongoing discussion about the async iteration by TC39.

        +

        The user agent must create a CacheStorage object when a Window object or a WorkerGlobalScope object is created and associate it with that global object.

        +

        A CacheStorage object represents a name to cache map of its associated global object’s environment settings object’s origin. Multiple separate objects implementing the CacheStorage interface across documents and workers can all be associated with the same name to cache map simultaneously.

        -

        5.5.1. match(request, options)

        -

        match(request, options) method must run these steps:

        +

        5.5.1. match(request, options)

        +

        match(request, options) method must run these steps:

        1. If options.cacheName is present, then: @@ -3457,7 +3457,7 @@

          If options.cacheName matches entry.[[key]], then:
            -
          1. Resolve p with the result of running the algorithm specified in match(request, options) method of Cache interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method of match(request, options).) +
          2. Resolve p with the result of running the algorithm specified in match(request, options) method of Cache interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method of match(request, options).)
          3. Abort these steps.

        @@ -3475,7 +3475,7 @@

        p to the result of transforming itself with a fulfillment handler that, when called with argument v, performs the following substeps in parallel:
        1. If v is not undefined, return v. -
        2. Return the result of running the algorithm specified in match(request, options) method of Cache interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method of match(request, options).) +
        3. Return the result of running the algorithm specified in match(request, options) method of Cache interface with request and options as the arguments (providing entry.[[value]] as thisArgument to the [[Call]] internal method of match(request, options).)

    19. Return p. @@ -3483,8 +3483,8 @@

    -

    5.5.2. has(cacheName)

    -

    has(cacheName) method must run these steps:

    +

    5.5.2. has(cacheName)

    +

    has(cacheName) method must run these steps:

    1. Return a promise p resolved with the result of running the following substeps: @@ -3503,8 +3503,8 @@

    -

    5.5.3. open(cacheName)

    -

    open(cacheName) method must run these steps:

    +

    5.5.3. open(cacheName)

    +

    open(cacheName) method must run these steps:

    1. Let p be a new promise.
    2. @@ -3516,11 +3516,11 @@

      If cacheName matches entry.[[key]], then:
        -
      1. Resolve p with a new Cache object which is a copy of entry.[[value]]. +
      2. Resolve p with a new Cache object which is a copy of entry.[[value]].
      3. Abort these steps.

    -
  • Let cache be a new Cache object. +
  • Let cache be a new Cache object.
  • Set a newly-created Record {[[key]]: cacheName, [[value]]: cache} to name to cache map. If this cache write operation failed due to exceeding the granted quota limit, reject p with a "QuotaExceededError" exception and abort these steps.
  • Resolve p with cache. @@ -3528,10 +3528,10 @@

  • -

    5.5.4. delete(cacheName)

    -

    delete(cacheName) method must run these steps:

    +

    5.5.4. delete(cacheName)

    +

    delete(cacheName) method must run these steps:

      -
    1. Let p be the result of running the algorithm specified in has(cacheName) method with cacheName as the argument. +
    2. Let p be the result of running the algorithm specified in has(cacheName) method with cacheName as the argument.
    3. Return the result of transforming p with a fulfillment handler that, when called with argument cacheExists, performs the following substeps in parallel:
        @@ -3552,8 +3552,8 @@

    -

    5.5.5. keys()

    -

    keys() method must run these steps:

    +

    5.5.5. keys()

    +

    keys() method must run these steps:

    The promise returned from this method resolves with the sequence of keys, cache names in DOMString, in insertion order.

    1. Let resultArray be an empty array. @@ -3596,9 +3596,9 @@

      6.3.2. importScripts(urls)

      -

      When the importScripts(urls) method is called on a ServiceWorkerGlobalScope object, the user agent must import scripts into worker global scope, given this ServiceWorkerGlobalScope object and urls, and with the following steps to perform the fetch given the request request:

      +

      When the importScripts(urls) method is called on a ServiceWorkerGlobalScope object, the user agent must import scripts into worker global scope, given this ServiceWorkerGlobalScope object and urls, and with the following steps to perform the fetch given the request request:

        -
      1. Let serviceWorker be request’s client’s global object’s service worker. +
      2. Let serviceWorker be request’s client’s global object’s service worker.
      3. If serviceWorker’s imported scripts updated flag is unset, then:
          @@ -3624,7 +3624,7 @@

          6.4. Cross-Origin Resources and CORS

          This section is non-normative.

          Applications tend to cache items that come from a CDN or other origin. It is possible to request many of them directly using <script>, <img>, <video> and <link> elements. It would be hugely limiting if this sort of runtime collaboration broke when offline. Similarly, it is possible to fetch many sorts of off-origin resources when appropriate CORS headers are set.

          -

          Service workers enable this by allowing Caches to fetch and cache off-origin items. Some restrictions apply, however. First, unlike same-origin resources which are managed in the Cache as Response objects whose corresponding responses are basic filtered response, the objects stored are Response objects whose corresponding responses are either CORS filtered responses or opaque filtered responses. They can be passed to event.respondWith(r) method in the same manner as the Response objects whose corresponding responses are basic filtered responses, but cannot be meaningfully created programmatically. These limitations are necessary to preserve the security invariants of the platform. Allowing Caches to store them allows applications to avoid re-architecting in most cases.

          +

          Service workers enable this by allowing Caches to fetch and cache off-origin items. Some restrictions apply, however. First, unlike same-origin resources which are managed in the Cache as Response objects whose corresponding responses are basic filtered response, the objects stored are Response objects whose corresponding responses are either CORS filtered responses or opaque filtered responses. They can be passed to event.respondWith(r) method in the same manner as the Response objects whose corresponding responses are basic filtered responses, but cannot be meaningfully created programmatically. These limitations are necessary to preserve the security invariants of the platform. Allowing Caches to store them allows applications to avoid re-architecting in most cases.

      6.5. Implementer Concerns

      @@ -3650,7 +3650,7 @@

      Service workers are extensible from other specifications.

      8.1. Define API bound to Service Worker Registration

      -

      Specifications may define an API tied to a service worker registration by using partial interface definition to the ServiceWorkerRegistration interface where it may define the specification specific attributes and methods:

      +

      Specifications may define an API tied to a service worker registration by using partial interface definition to the ServiceWorkerRegistration interface where it may define the specification specific attributes and methods:

      partial interface ServiceWorkerRegistration {
         // e.g. define an API namespace
         readonly attribute APISpaceType APISpace;
      @@ -3661,7 +3661,7 @@ 

      8.2. Define Functional Event

      -

      Specifications may define a functional event by extending ExtendableEvent interface:

      +

      Specifications may define a functional event by extending ExtendableEvent interface:

      // e.g. define FunctionalEvent interface
       interface FunctionalEvent : ExtendableEvent {
         // add a functional event’s own attributes and methods
      @@ -3670,7 +3670,7 @@ 

      8.3. Define Event Handler

      -

      Specifications may define an event handler attribute for the corresponding functional event using partial interface definition to the ServiceWorkerGlobalScope interface:

      +

      Specifications may define an event handler attribute for the corresponding functional event using partial interface definition to the ServiceWorkerGlobalScope interface:

      partial interface ServiceWorkerGlobalScope {
         attribute EventHandler onfunctionalevent;
       };
      @@ -3679,7 +3679,7 @@ 

      8.4. 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.

      -

      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 queued by Handle Functional Event algorithm.

      +

      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 queued by Handle Functional Event algorithm.

      See an example hook defined in Notifications API.

      @@ -3856,7 +3856,7 @@

      Regist
    2. If newestWorker is not null and job’s script url equals newestWorker’s script url with the exclude fragments flag set, then:
        -
      1. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration. +
      2. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration.
      3. Invoke Finish Job with job and abort these steps.
    @@ -3971,7 +3971,7 @@

    Update If newestWorker is not null, newestWorker’s script url equals job’s script url with the exclude fragments flag set, and script is a byte-for-byte match with newestWorker’s script resource, then:
      -
    1. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration. +
    2. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration.
    3. Invoke Finish Job with job and abort these steps.
  • @@ -4031,20 +4031,20 @@

    In
  • Run the Update Registration State algorithm passing registration, "installing" and worker as the arguments.
  • Run the Update Worker State algorithm passing registration’s installing worker and installing as the arguments.
  • Assert: job’s promise is not null. -
  • Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration. -
  • Queue a task to fire an event named updatefound at all the ServiceWorkerRegistration objects for all the service worker clients whose creation URL matches registration’s scope url and all the service workers whose containing service worker registration is registration. +
  • Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration. +
  • Queue a task to fire an event named updatefound at all the ServiceWorkerRegistration objects for all the service worker clients whose creation URL matches registration’s scope url and all the service workers whose containing service worker registration is registration.
  • Let installingWorker be registration’s installing worker.
  • Invoke Run Service Worker algorithm with installingWorker as the argument.
  • Queue a task task to run the following substeps:
      -
    1. Create a trusted event e that uses the ExtendableEvent interface, with the event type install, which does not bubble and is not cancelable. +
    2. Create a trusted event e that uses the ExtendableEvent interface, with the event type install, which does not bubble and is not cancelable.
    3. Dispatch e at installingWorker’s environment settings object’s global object globalObject.
    4. WaitForAsynchronousExtensions: Run the following substeps in parallel:
      1. Wait until e’s extensions allowed flag is unset. -
      2. If the result of waiting for all of e’s extend lifetime promises rejected, set installFailed to true. +
      3. If the result of waiting for all of e’s extend lifetime promises rejected, set installFailed to true.

    If task is discarded or the script has been aborted by the termination of installingWorker, set installFailed to true.

    @@ -4125,7 +4125,7 @@

    Acti
  • Queue a task task to run the following substeps:
      -
    1. Create a trusted event e that uses the ExtendableEvent interface, with the event type activate, which does not bubble and is not cancelable. +
    2. Create a trusted event e that uses the ExtendableEvent interface, with the event type activate, which does not bubble and is not cancelable.
    3. Dispatch e at activeWorker’s environment settings object’s global object.
    4. WaitForAsynchronousExtensions: Wait, in parallel, until e’s extensions allowed flag is unset.
    @@ -4150,7 +4150,7 @@

    InitializeHostDefinedRealm() abstract operation with the following customizations:
  • Let workerEventLoop be a newly created event loop. @@ -4189,7 +4189,7 @@

    has ever been evaluated flag is unset, then:
    1. - Set workerGlobalScope’s associated service worker’s set of event types to handle to the set of event types created from settingsObject’s global object’s associated list of event listeners' event types. + Set workerGlobalScope’s associated service worker’s set of event types to handle to the set of event types created from settingsObject’s global object’s associated list of event listeners' event types.

      If the global object’s associated list of event listeners does not have any event listener added at this moment, the service worker’s set of event types to handle is set to an empty set. The user agents are encouraged to show a warning that the event listeners must be added on the very first evaluation of the worker script.

    2. Set script’s has ever been evaluated flag.
    @@ -4276,12 +4276,12 @@

  • @@ -4648,11 +4648,11 @@

    C
    Input
    client, a service worker client
    Output -
    clientObject, a Client object +
    clientObject, a Client object
      -
    1. Let clientObject be a new Client object. -
    2. Set clientObject’s service worker client to client. +
    3. Let clientObject be a new Client object. +
    4. Set clientObject’s service worker client to client.
    5. Return clientObject.

    @@ -4669,7 +4669,7 @@

    WindowClient object. -
  • Set windowClient’s service worker client to client. +
  • Set windowClient’s service worker client to client.
  • Set windowClient’s visibility state to visibilityState.
  • Set windowClient’s focus state to focusState.
  • Set windowClient’s ancestor origins array to ancestorOrigins. @@ -4681,7 +4681,7 @@

    Que
    Input
    request, a Request object -
    options, a CacheQueryOptions object, optional +
    options, a CacheQueryOptions object, optional
    targetStorage, an array that has [Request, Response] pairs as its elements, optional
    Output
    resultArray, an array that has [Request, Response] pairs as its elements @@ -4767,7 +4767,7 @@

    Que

    Batch Cache Operations

    Input -
    operations, an array of CacheBatchOperation dictionary objects +
    operations, an array of CacheBatchOperation dictionary objects
    Output
    promise, a promise resolves with an array of Response objects.
    @@ -4952,87 +4952,87 @@

    "activated", in §3.1
  • activating, in §3.1
  • "activating", in §3.1 -
  • active, in §3.2.3 +
  • active, in §3.2.3
  • active worker, in §2.2 -
  • addAll(requests), in §5.4.4 -
  • add(request), in §5.4.3 +
  • addAll(requests), in §5.4.4 +
  • add(request), in §5.4.3
  • all, in §4.3
  • "all", in §4.3 -
  • ancestorOrigins, in §4.2.7 +
  • ancestorOrigins, in §4.2.7
  • ancestor origins array, in §4.2 -
  • Cache, in §5.4 -
  • CacheBatchOperation, in §5.4 +
  • Cache, in §5.4 +
  • CacheBatchOperation, in §5.4
  • cacheName, in §5.4 -
  • CacheQueryOptions, in §5.4 +
  • CacheQueryOptions, in §5.4
  • caches, in §5.3.1 -
  • CacheStorage, in §5.5 -
  • claim(), in §4.3.4 -
  • Client, in §4.2 +
  • CacheStorage, in §5.5 +
  • claim(), in §4.3.4 +
  • Client, in §4.2
  • client, in §Unnumbered section
  • clientId
  • client message queue, in §3.4 -
  • ClientQueryOptions, in §4.3 -
  • Clients, in §4.3 -
  • clients, in §4.1.1 -
  • ClientType, in §4.3 +
  • ClientQueryOptions, in §4.3 +
  • Clients, in §4.3 +
  • clients, in §4.1.1 +
  • ClientType, in §4.3
  • containing service worker registration, in §2.1
  • control, in §2.4 -
  • controller, in §3.4.1 +
  • controller, in §3.4.1
  • controllerchange, in §3.6
  • data
  • dedicated worker client, in §2.3 -
  • delete(cacheName), in §5.5.4 -
  • delete(request), in §5.4.6 -
  • delete(request, options), in §5.4.6 +
  • delete(cacheName), in §5.5.4 +
  • delete(request), in §5.4.6 +
  • delete(request, options), in §5.4.6
  • equivalent, in §Unnumbered section -
  • ExtendableEvent, in §4.4 +
  • ExtendableEvent, in §4.4
  • ExtendableEventInit, in §4.4
  • ExtendableEvent(type), in §4.4
  • ExtendableEvent(type, eventInitDict), in §4.4 -
  • ExtendableMessageEvent, in §4.6 -
  • ExtendableMessageEventInit, in §4.6 +
  • ExtendableMessageEvent, in §4.6 +
  • ExtendableMessageEventInit, in §4.6
  • ExtendableMessageEvent(type), in §4.6
  • ExtendableMessageEvent(type, eventInitDict), in §4.6 -
  • extend lifetime promises, in §4.4 +
  • extend lifetime promises, in §4.4
  • extensions allowed flag, in §4.4
  • fetch, in §4.7 -
  • FetchEvent, in §4.5 -
  • FetchEventInit, in §4.5 +
  • FetchEvent, in §4.5 +
  • FetchEventInit, in §4.5
  • FetchEvent(type, eventInitDict), in §4.5
  • fetching record, in §5.1 -
  • focus(), in §4.2.8 -
  • focused, in §4.2.6 +
  • focus(), in §4.2.8 +
  • focused, in §4.2.6
  • focus state, in §4.2
  • force bypass cache flag, in §Unnumbered section
  • functional events, in §2.1 -
  • get(id), in §4.3.1 -
  • getRegistration(), in §3.4.4 -
  • getRegistration(clientURL), in §3.4.4 -
  • getRegistrations(), in §3.4.5 +
  • get(id), in §4.3.1 +
  • getRegistration(), in §3.4.4 +
  • getRegistration(clientURL), in §3.4.4 +
  • getRegistrations(), in §3.4.5
  • global object, in §5.5
  • Handle Fetch, in §Unnumbered section
  • handle fetch task source, in §2.5
  • handle functional event task source, in §2.5 -
  • has(cacheName), in §5.5.2 +
  • has(cacheName), in §5.5.2
  • has ever been evaluated flag, in §2.1
  • HTTPS state, in §2.1
  • id
  • ignoreMethod, in §5.4
  • ignoreSearch, in §5.4 @@ -5050,14 +5050,14 @@

    enum-value for ServiceWorkerState, in §3.1 -
  • attribute for ServiceWorkerRegistration, in §3.2.1 +
  • attribute for ServiceWorkerRegistration, in §3.2.1
  • installing worker, in §2.2
  • isReload
  • job, in §Unnumbered section
  • job promise, in §Unnumbered section @@ -5066,18 +5066,18 @@

    method for Cache, in §5.4.7 -
  • method for CacheStorage, in §5.5.5 +
  • method for Cache, in §5.4.7 +
  • method for CacheStorage, in §5.5.5 -
  • keys(request), in §5.4.7 -
  • keys(request, options), in §5.4.7 +
  • keys(request), in §5.4.7 +
  • keys(request, options), in §5.4.7
  • lastEventId
  • last update check time, in §2.2
  • lifecycle events, in §2.1 @@ -5085,23 +5085,23 @@

    method for Clients, in §4.3.2 -
  • method for Cache, in §5.4.2 +
  • method for Clients, in §4.3.2 +
  • method for Cache, in §5.4.2 -
  • matchAll(options), in §4.3.2 -
  • matchAll(request), in §5.4.2 -
  • matchAll(request, options), in §5.4.2 +
  • matchAll(options), in §4.3.2 +
  • matchAll(request), in §5.4.2 +
  • matchAll(request, options), in §5.4.2
  • match(request)
  • match(request, options)
  • Match Service Worker Registration, in §Unnumbered section
  • @@ -5111,82 +5111,82 @@

    event for ServiceWorkerGlobalScope, in §4.7
  • name to cache map, in §5.1 -
  • navigate(url), in §4.2.9 -
  • onactivate, in §4.1.4 -
  • oncontrollerchange, in §3.4.7 -
  • onfetch, in §4.1.4 -
  • oninstall, in §4.1.4 +
  • navigate(url), in §4.2.9 +
  • onactivate, in §4.1.4 +
  • oncontrollerchange, in §3.4.7 +
  • onfetch, in §4.1.4 +
  • oninstall, in §4.1.4
  • onmessage -
  • onstatechange, in §3.1.4 -
  • onupdatefound, in §3.2.7 -
  • open(cacheName), in §5.5.3 -
  • openWindow(url), in §4.3.3 +
  • onstatechange, in §3.1.4 +
  • onupdatefound, in §3.2.7 +
  • open(cacheName), in §5.5.3 +
  • openWindow(url), in §4.3.3
  • options, in §5.4
  • origin
  • ports -
  • postMessage(message), in §4.2.4 +
  • postMessage(message), in §4.2.4
  • postMessage(message, transfer) -
  • potential response, in §4.5 +
  • potential response, in §4.5
  • processing equivalence, in §Unnumbered section -
  • put(request, response), in §5.4.5 -
  • ready, in §3.4.2 -
  • ready promise, in §3.4 +
  • put(request, response), in §5.4.5 +
  • ready, in §3.4.2 +
  • ready promise, in §3.4
  • "redundant", in §3.1
  • redundant, in §3.1
  • referrer policy, in §2.1
  • registering script url, in §2.2 -
  • register(scriptURL), in §3.4.3 -
  • register(scriptURL, options), in §3.4.3 -
  • registration, in §4.1.2 -
  • RegistrationOptions, in §3.4 +
  • register(scriptURL), in §3.4.3 +
  • register(scriptURL, options), in §3.4.3 +
  • registration, in §4.1.2 +
  • RegistrationOptions, in §3.4
  • request
  • request to response map, in §5.1 -
  • reserved, in §4.2.3 +
  • reserved, in §4.2.3
  • reservedClientId
  • respond-with entered flag, in §4.5
  • respond-with error flag, in §4.5 -
  • respondWith(r), in §4.5.6 +
  • respondWith(r), in §4.5.6
  • response, in §5.4
  • scope
  • scope to registration map, in §Unnumbered section @@ -5204,66 +5204,66 @@

    dfn for service worker, in §2.1
  • definition of, in §Unnumbered section -
  • scriptURL, in §3.1.1 +
  • scriptURL, in §3.1.1
  • selection, in §2.4 +
  • ServiceWorker, in §3.1
  • Service-Worker, in §Unnumbered section -
  • ServiceWorker, in §3.1
  • serviceWorker, in §3.3
  • service worker
  • Service-Worker-Allowed, in §Unnumbered section
  • service worker client -
  • ServiceWorkerContainer, in §3.4 -
  • ServiceWorkerGlobalScope, in §4.1 -
  • ServiceWorkerMessageEvent, in §3.5 -
  • ServiceWorkerMessageEventInit, in §3.5 +
  • ServiceWorkerContainer, in §3.4 +
  • ServiceWorkerGlobalScope, in §4.1 +
  • ServiceWorkerMessageEvent, in §3.5 +
  • ServiceWorkerMessageEventInit, in §3.5
  • ServiceWorkerMessageEvent(type), in §3.5
  • ServiceWorkerMessageEvent(type, eventInitDict), in §3.5 -
  • ServiceWorkerRegistration, in §3.2 +
  • ServiceWorkerRegistration, in §3.2
  • service worker registration
  • ServiceWorkerState, in §3.1.2
  • set of event types to handle, in §2.1
  • sharedworker, in §4.3
  • "sharedworker", in §4.3
  • shared worker client, in §2.3 -
  • skipWaiting(), in §4.1.3 +
  • skipWaiting(), in §4.1.3
  • skip waiting flag, in §2.1
  • source -
  • startMessages(), in §3.4.6 +
  • startMessages(), in §3.4.6
  • state -
  • statechange, in §3.6 +
  • statechange, in §3.6
  • targetClientId
  • task queues, in §2.2
  • @@ -5275,17 +5275,17 @@

    dict-member for CacheBatchOperation, in §5.4
  • uninstalling flag, in §2.2 -
  • unregister(), in §3.2.6 -
  • update(), in §3.2.5 +
  • unregister(), in §3.2.6 +
  • update(), in §3.2.5
  • updatefound, in §3.6 -
  • url, in §4.2.1 +
  • url, in §4.2.1
  • using, in §2.4
  • visibility state, in §4.2 -
  • visibilityState, in §4.2.5 -
  • waiting, in §3.2.2 +
  • visibilityState, in §4.2.5 +
  • waiting, in §3.2.2
  • waiting worker, in §2.2
  • wait to respond flag, in §4.5 -
  • waitUntil(f), in §4.4.1 +
  • waitUntil(f), in §4.4.1
  • window, in §4.3
  • "window", in §4.3
  • window client, in §2.3 @@ -5610,15 +5610,15 @@

    IDL Index

    [SecureContext, Exposed=(Window,Worker)]
    -interface ServiceWorker : EventTarget {
    -  readonly attribute USVString scriptURL;
    -  readonly attribute ServiceWorkerState state;
    -  void postMessage(any message, optional sequence<object> transfer = []);
    +interface ServiceWorker : EventTarget {
    +  readonly attribute USVString scriptURL;
    +  readonly attribute ServiceWorkerState state;
    +  void postMessage(any message, optional sequence<object> transfer = []);
     
       // event
    -  attribute EventHandler onstatechange;
    +  attribute EventHandler onstatechange;
     };
    -ServiceWorker implements AbstractWorker;
    +ServiceWorker implements AbstractWorker;
     
     enum ServiceWorkerState {
       "installing",
    @@ -5629,118 +5629,118 @@ 

    I }; [SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerRegistration : EventTarget { - readonly attribute ServiceWorker? installing; - readonly attribute ServiceWorker? waiting; - readonly attribute ServiceWorker? active; +interface ServiceWorkerRegistration : EventTarget { + readonly attribute ServiceWorker? installing; + readonly attribute ServiceWorker? waiting; + readonly attribute ServiceWorker? active; - readonly attribute USVString scope; + readonly attribute USVString scope; - [NewObject] Promise<void> update(); - [NewObject] Promise<boolean> unregister(); + [NewObject] Promise<void> update(); + [NewObject] Promise<boolean> unregister(); // event - attribute EventHandler onupdatefound; + attribute EventHandler onupdatefound; }; partial interface Navigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; }; partial interface WorkerNavigator { - [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; + [SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker; }; [SecureContext, Exposed=(Window,Worker)] -interface ServiceWorkerContainer : EventTarget { - readonly attribute ServiceWorker? controller; - [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; +interface ServiceWorkerContainer : EventTarget { + readonly attribute ServiceWorker? controller; + [SameObject] readonly attribute Promise<ServiceWorkerRegistration> ready; - [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); + [NewObject] Promise<ServiceWorkerRegistration> register(USVString scriptURL, optional RegistrationOptions options); - [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); - [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); + [NewObject] Promise<any> getRegistration(optional USVString clientURL = ""); + [NewObject] Promise<sequence<ServiceWorkerRegistration>> getRegistrations(); - void startMessages(); + void startMessages(); // events - attribute EventHandler oncontrollerchange; - attribute EventHandler onmessage; // event.source of message events is ServiceWorker object + attribute EventHandler oncontrollerchange; + attribute EventHandler onmessage; // event.source of message events is ServiceWorker object }; -dictionary RegistrationOptions { +dictionary RegistrationOptions { USVString scope; WorkerType type = "classic"; }; -[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] -interface ServiceWorkerMessageEvent : Event { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +[Constructor(DOMString type, optional ServiceWorkerMessageEventInit eventInitDict), Exposed=(Window,Worker)] +interface ServiceWorkerMessageEvent : Event { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; }; -dictionary ServiceWorkerMessageEventInit : EventInit { +dictionary ServiceWorkerMessageEventInit : EventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (ServiceWorker or MessagePort)? source = null; + (ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; }; -[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] -interface ServiceWorkerGlobalScope : WorkerGlobalScope { +[Global=(Worker,ServiceWorker), Exposed=ServiceWorker] +interface ServiceWorkerGlobalScope : WorkerGlobalScope { // A container for a list of Client objects that correspond to // browsing contexts (or shared workers) that are on the origin of this SW - [SameObject] readonly attribute Clients clients; - [SameObject] readonly attribute ServiceWorkerRegistration registration; + [SameObject] readonly attribute Clients clients; + [SameObject] readonly attribute ServiceWorkerRegistration registration; - [NewObject] Promise<void> skipWaiting(); + [NewObject] Promise<void> skipWaiting(); - attribute EventHandler oninstall; - attribute EventHandler onactivate; - attribute EventHandler onfetch; + attribute EventHandler oninstall; + attribute EventHandler onactivate; + attribute EventHandler onfetch; // event - attribute EventHandler onmessage; // event.source of the message events is Client object + attribute EventHandler onmessage; // event.source of the message events is Client object }; [Exposed=ServiceWorker] -interface Client { - readonly attribute USVString url; - readonly attribute DOMString id; - readonly attribute boolean reserved; - void postMessage(any message, optional sequence<object> transfer); +interface Client { + readonly attribute USVString url; + readonly attribute DOMString id; + readonly attribute boolean reserved; + void postMessage(any message, optional sequence<object> transfer); }; [Exposed=ServiceWorker] -interface WindowClient : Client { - readonly attribute VisibilityState visibilityState; - readonly attribute boolean focused; - [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; - [NewObject] Promise<WindowClient> focus(); - [NewObject] Promise<WindowClient> navigate(USVString url); +interface WindowClient : Client { + readonly attribute VisibilityState visibilityState; + readonly attribute boolean focused; + [SameObject] readonly attribute FrozenArray<USVString> ancestorOrigins; + [NewObject] Promise<WindowClient> focus(); + [NewObject] Promise<WindowClient> navigate(USVString url); }; [Exposed=ServiceWorker] -interface Clients { +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(); + [NewObject] Promise<any> get(DOMString id); + [NewObject] Promise<sequence<Client>> matchAll(optional ClientQueryOptions options); + [NewObject] Promise<WindowClient?> openWindow(USVString url); + [NewObject] Promise<void> claim(); }; -dictionary ClientQueryOptions { +dictionary ClientQueryOptions { boolean includeUncontrolled = false; boolean includeReserved = false; - ClientType type = "window"; + ClientType type = "window"; }; -enum ClientType { +enum ClientType { "window", "worker", "sharedworker", @@ -5748,26 +5748,26 @@

    I }; [Constructor(DOMString type, optional ExtendableEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableEvent : Event { - void waitUntil(Promise<any> f); +interface ExtendableEvent : Event { + void waitUntil(Promise<any> f); }; dictionary ExtendableEventInit : EventInit { // Defined for the forward compatibility across the derived events }; -[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] -interface FetchEvent : ExtendableEvent { - [SameObject] readonly attribute Request request; - readonly attribute DOMString clientId; - readonly attribute DOMString reservedClientId; - readonly attribute DOMString targetClientId; - readonly attribute boolean isReload; +[Constructor(DOMString type, FetchEventInit eventInitDict), Exposed=ServiceWorker] +interface FetchEvent : ExtendableEvent { + [SameObject] readonly attribute Request request; + readonly attribute DOMString clientId; + readonly attribute DOMString reservedClientId; + readonly attribute DOMString targetClientId; + readonly attribute boolean isReload; - void respondWith(Promise<Response> r); + void respondWith(Promise<Response> r); }; -dictionary FetchEventInit : ExtendableEventInit { +dictionary FetchEventInit : ExtendableEventInit { required Request request; DOMString clientId = null; DOMString reservedClientId = ""; @@ -5775,59 +5775,59 @@

    I boolean isReload = false; }; -[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] -interface ExtendableMessageEvent : ExtendableEvent { - readonly attribute any data; - readonly attribute USVString origin; - readonly attribute DOMString lastEventId; - [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; - readonly attribute FrozenArray<MessagePort> ports; +[Constructor(DOMString type, optional ExtendableMessageEventInit eventInitDict), Exposed=ServiceWorker] +interface ExtendableMessageEvent : ExtendableEvent { + readonly attribute any data; + readonly attribute USVString origin; + readonly attribute DOMString lastEventId; + [SameObject] readonly attribute (Client or ServiceWorker or MessagePort)? source; + readonly attribute FrozenArray<MessagePort> ports; }; -dictionary ExtendableMessageEventInit : ExtendableEventInit { +dictionary ExtendableMessageEventInit : ExtendableEventInit { any data = null; USVString origin = ""; DOMString lastEventId = ""; - (Client or ServiceWorker or MessagePort)? source = null; + (Client or ServiceWorker or MessagePort)? source = null; sequence<MessagePort> ports = []; }; partial interface WindowOrWorkerGlobalScope { - [SecureContext, SameObject] readonly attribute CacheStorage caches; + [SecureContext, SameObject] readonly attribute CacheStorage caches; }; [SecureContext, Exposed=(Window,Worker)] -interface Cache { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<void> add(RequestInfo request); - [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); - [NewObject] Promise<void> put(RequestInfo request, Response response); - [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); +interface Cache { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Response>> matchAll(optional RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<void> add(RequestInfo request); + [NewObject] Promise<void> addAll(sequence<RequestInfo> requests); + [NewObject] Promise<void> put(RequestInfo request, Response response); + [NewObject] Promise<boolean> delete(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<sequence<Request>> keys(optional RequestInfo request, optional CacheQueryOptions options); }; -dictionary CacheQueryOptions { +dictionary CacheQueryOptions { boolean ignoreSearch = false; boolean ignoreMethod = false; boolean ignoreVary = false; DOMString cacheName; }; -dictionary CacheBatchOperation { +dictionary CacheBatchOperation { DOMString type; Request request; Response response; - CacheQueryOptions options; + CacheQueryOptions options; }; [SecureContext, Exposed=(Window,Worker)] -interface CacheStorage { - [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); - [NewObject] Promise<boolean> has(DOMString cacheName); - [NewObject] Promise<Cache> open(DOMString cacheName); - [NewObject] Promise<boolean> delete(DOMString cacheName); - [NewObject] Promise<sequence<DOMString>> keys(); +interface CacheStorage { + [NewObject] Promise<any> match(RequestInfo request, optional CacheQueryOptions options); + [NewObject] Promise<boolean> has(DOMString cacheName); + [NewObject] Promise<Cache> open(DOMString cacheName); + [NewObject] Promise<boolean> delete(DOMString cacheName); + [NewObject] Promise<sequence<DOMString>> keys(); };

    @@ -6270,44 +6270,44 @@

    Handle Functional Event -