diff --git a/docs/v1/index.bs b/docs/v1/index.bs index 285c27c9..67f40d1d 100644 --- a/docs/v1/index.bs +++ b/docs/v1/index.bs @@ -40,76 +40,16 @@ Markup Shorthands: css no
 spec: dom-ls; urlPrefix: https://dom.spec.whatwg.org/
     type: dfn; text: ASCII case-insensitive; url: ascii-case-insensitive
 
-spec: ecma-262; urlPrefix: http://www.ecma-international.org/ecma-262/6.0/
+spec: ecma-262; urlPrefix: http://tc39.github.io/ecma262/
     type: dfn
         text: Assert; url: sec-algorithm-conventions
         text: [[Call]]; url: sec-ecmascript-function-objects-call-thisargument-argumentslist
@@ -201,44 +141,16 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
     type: dfn
         urlPrefix: browsers.html
             text: origin; for: resource; url: origin-2
-        urlPrefix: infrastructure.html
-            text: StructuredCloneWithTransfer
         urlPrefix: interaction.html
             text: has focus steps
         urlPrefix: webappapis.html
-            text: classic script
-            text: creation url
             text: dom manipulation task source
-            text: fetch a classic worker script
-            text: fetch a module worker script tree
-            text: fire a simple event
-            text: https state; for: environment settings object
-            text: module script
-            text: realm execution context
-            text: referrer policy; for: environment settings object; url: concept-settings-object-referrer-policy
-            text: relevant Realm; url: concept-relevant-realm
-            text: relevant global object; url: concept-relevant-global
-            text: report the error
             text: run a classic script
             text: run a module script
-            text: script; url: concept-script
             text: task queue; for: event loop
-            text: the global object's Realm; url: concept-global-object-realm
-            text: the Realm's global object; url: concept-realm-global
         urlPrefix: workers.html
-            text: get a fetch result
-            text: import scripts into worker global scope
-            text: postprocess the fetch result
-            text: runtime script errors handling; url: runtime-script-errors-2
             text: shared workers
-            text: terminate a worker
-            text: validate the state
             text: web worker; url: workers
-            for: workerglobalscope; urlPrefix: #concept-workerglobalscope-
-                text: https state
-                text: referrer policy
-                text: type
-                text: url
     type: event
         urlPrefix: indices.html
             text: DOMContentLoaded; for: Document; url: event-domcontentloaded
@@ -276,18 +188,6 @@ spec: url; urlPrefix: https://url.spec.whatwg.org/
     type: dfn
         text: parsing; for: url; url: concept-url-parser
         text: serialized; for: url; url: concept-url-serializer
-
-spec: webidl; urlPrefix: https://heycam.github.io/webidl/
-    type: dfn
-        text: throw; url: dfn-throw
-    type: exception
-        text: DataCloneError
-        text: InvalidAccessError
-        text: InvalidStateError
-        text: NetworkError
-        text: NotFoundError
-        text: QuotaExceededError
-        text: SecurityError
 
@@ -350,7 +250,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/

A service worker registration has an associated active worker (a service worker or null) whose state is either activating or activated. It is initially set to null.

A service worker registration has an associated last update check time. It is initially set to null.

A service worker registration has an associated uninstalling flag. It is initially unset.

-

A service worker registration has one or more task queues that back up the tasks from its active worker's event loop's corresponding task queues. (The target task sources for this back up operation are the handle fetch task source and the handle functional event task source.) The user agent dumps the active worker's tasks to the service worker registration's task queues when the active worker is terminated and re-queues those tasks to the active worker's event loop's corresponding task queues when the active worker spins off. Unlike the task queues owned by event loops, the service worker registration's task queues are not processed by any event loops in and of itself.

+

A service worker registration has one or more task queues that back up the tasks from its active worker's event loop's corresponding task queues. (The target task sources for this back up operation are the handle fetch task source and the handle functional event task source.) The user agent dumps the active worker's tasks to the service worker registration's task queues when the active worker is terminated and re-queues those tasks to the active worker's event loop's corresponding task queues when the active worker spins off. Unlike the task queues owned by event loops, the service worker registration's task queues are not processed by any event loops in and of itself.

Lifetime

@@ -502,9 +402,9 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
  • Let serviceWorker be the service worker represented by the context object.
  • Invoke Run Service Worker algorithm with serviceWorker as the argument.
  • Let destination be the {{ServiceWorkerGlobalScope}} object associated with serviceWorker.
  • -
  • Let targetRealm be destination's Realm.
  • +
  • Let targetRealm be destination's Realm.
  • Let incumbentSettings be the incumbent settings object, and incumbentGlobal its global object.
  • -
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
  • +
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
  • Let clonedMessage be cloneRecord.\[[Clone]].
  • Let newPorts be a new frozen array consisting of all {{MessagePort}} objects in cloneRecord.\[[TransferList]], if any, maintaining their relative order.
  • Queue a task that runs the following steps: @@ -513,7 +413,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
  • Let the {{ExtendableMessageEvent/data}} attribute of e be initialized to clonedMessage.
  • Let the {{ExtendableMessageEvent/origin}} attribute of e be initialized to the Unicode serialization of incumbentSettings's origin.
  • 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.
  • -
  • 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.
  • +
  • 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.
  • Else, let it be initialized to a new {{Client}} object that represents the worker associated with incumbentGlobal.
  • Let the {{ExtendableMessageEvent/ports}} attribute of e be initialized to newPorts.
  • Dispatch e at destination.
  • @@ -1182,15 +1082,15 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
    auxiliary
    "auxiliary" -

    The window client's global object's browsing context is an auxiliary browsing context.

    +

    The window client's global object's browsing context is an auxiliary browsing context.

    top-level
    "top-level" -

    The window client's global object's browsing context is a top-level browsing context.

    +

    The window client's global object's browsing context is a top-level browsing context.

    nested
    "nested" -

    The window client's global object's browsing context is a nested browsing context.

    +

    The window client's global object's browsing context is a nested browsing context.

    none
    "none"
    @@ -1213,7 +1113,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
  • Let destination be the {{ServiceWorkerContainer}} object whose service worker client is the context object's service worker client.
  • If destination is null, throw an "{{InvalidStateError}}" exception.
  • Let targetRealm be destination's relevant Realm.
  • -
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
  • +
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
  • Let clonedMessage be cloneRecord.\[[Clone]].
  • Let newPorts be a new frozen array consisting of all {{MessagePort}} objects in cloneRecord.\[[TransferList]], if any, maintaining their relative order.
  • Add a task that runs the following steps to destination's client message queue: @@ -1251,7 +1151,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
  • Let promise be a new promise.
  • 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 null.
    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: @@ -1284,7 +1184,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
    7. Let promise be a new promise.
    8. 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. @@ -1360,7 +1260,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
      8. If client is not a secure context, reject promise with a "{{SecurityError}}" exception and abort these steps.
      9. If client is a window client, then:
          -
        1. Let browsingContext be client's global object's browsing context.
        2. +
        3. Let browsingContext be client's global object's browsing context.
        4. Let visibilityState be null.
        5. Let focusState be null.
        6. Queue a task task to run the following substeps: @@ -1421,7 +1321,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
          1. If options.{{ClientQueryOptions/type}} is "window", and client is a window client, then:
              -
            1. Let browsingContext be client's global object's browsing context.
            2. +
            3. Let browsingContext be client's global object's browsing context.
            4. Let isClientEnumerable be false.
            5. Let visibilityState be the empty string.
            6. Let focusState be false.
            7. @@ -1457,7 +1357,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
              1. If client is a window client, then:
                  -
                1. Let browsingContext be client's global object's browsing context.
                2. +
                3. Let browsingContext be client's global object's browsing context.
                4. Let isClientEnumerable be false.
                5. Let visibilityState be the empty string.
                6. Let focusState be false.
                7. @@ -3056,12 +2956,12 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                8. Run the Update Worker State algorithm passing registration's installing worker and installing as the arguments.
                9. Assert: job's promise is not null.
                10. Invoke Resolve Job Promise with job and the {{ServiceWorkerRegistration}} object which represents registration.
                11. -
                12. Queue a task to fire a simple 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.
                13. +
                14. 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.
                15. Let installingWorker be registration's installing worker.
                16. Invoke Run Service Worker algorithm with installingWorker as the argument.
                17. 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. +
                  3. Create a trusted event e that uses the {{ExtendableEvent}} interface, with the event type install, which does not bubble and is not cancelable.
                  4. Dispatch e at installingWorker's environment settings object's global object globalObject.
                  5. WaitForAsynchronousExtensions: Run the following substeps in parallel:
                      @@ -3151,7 +3051,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                    1. Invoke Run Service Worker algorithm with activeWorker as the argument.
                    2. 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. +
                      3. Create a trusted event e that uses the {{ExtendableEvent}} interface, with the event type activate, which does not bubble and is not cancelable.
                      4. Dispatch e at activeWorker's environment settings object's global object.
                      5. WaitForAsynchronousExtensions: Wait, in parallel, until e's extensions allowed flag is unset.
                      @@ -3183,17 +3083,17 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                    3. Let workerEventLoop be a newly created event loop.
                    4. -
                    5. Let workerGlobalScope be realmExecutionContext's global object.
                    6. +
                    7. Let workerGlobalScope be realmExecutionContext's global object.
                    8. Let settingsObject be a new environment settings object whose algorithms are defined as follows:
                      -
                      The realm execution context
                      +
                      The realm execution context
                      Return realmExecutionContext.
                      The global object
                      Return workerGlobalScope.
                      The responsible event loop
                      Return workerEventLoop.
                      The referrer policy
                      -
                      Return workerGlobalScope's referrer policy.
                      +
                      Return workerGlobalScope's referrer policy.
                      The API URL character encoding
                      Return UTF-8.
                      The API base URL
                      @@ -3201,17 +3101,17 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                      The origin
                      Return its registering service worker client's origin.
                      The creation URL
                      -
                      Return workerGlobalScope's url.
                      +
                      Return workerGlobalScope's url.
                      The HTTPS state
                      -
                      Return workerGlobalScope's HTTPS state.
                      +
                      Return workerGlobalScope's HTTPS state.
                    9. -
                    10. Set workerGlobalScope's url to serviceWorker's script url.
                    11. -
                    12. Set workerGlobalScope's HTTPS state to serviceWorker's script resource's HTTPS state.
                    13. -
                    14. Set workerGlobalScope's referrer policy to serviceWorker's script resource's referrer policy.
                    15. -
                    16. Set workerGlobalScope's type to serviceWorker's type.
                    17. +
                    18. Set workerGlobalScope's url to serviceWorker's script url.
                    19. +
                    20. Set workerGlobalScope's HTTPS state to serviceWorker's script resource's HTTPS state.
                    21. +
                    22. Set workerGlobalScope's referrer policy to serviceWorker's script resource's referrer policy.
                    23. +
                    24. Set workerGlobalScope's type to serviceWorker's type.
                    25. Create a new {{WorkerLocation}} object and associate it with workerGlobalScope.
                    26. -
                    27. If serviceWorker is an active worker, and there are any tasks queued in serviceWorker's containing service worker registration's task queues, queue them to serviceWorker's event loop's task queues in the same order using their original task sources.
                    28. +
                    29. If serviceWorker is an active worker, and there are any tasks queued in serviceWorker's containing service worker registration's task queues, queue them to serviceWorker's event loop's task queues in the same order using their original task sources.
                    30. If script is a classic script, then run the classic script script. Otherwise, it is a module script; run the module script script.

                      In addition to the usual possibilities of returning a value or failing due to an exception, this could be prematurely aborted by the kill a worker or terminate a worker algorithms.

                    31. @@ -3241,7 +3141,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                    32. If serviceWorker is not running, abort these steps.
                    33. Let serviceWorkerGlobalScope be serviceWorker's environment settings object's global object.
                    34. Set serviceWorkerGlobalScope's closing flag to true.
                    35. -
                    36. If there are any tasks, whose task source is either the handle fetch task source or the handle functional event task source, queued in serviceWorkerGlobalScope's event loop's task queues, queue them to serviceWorker's containing service worker registration's corresponding task queues in the same order using their original task sources, and discard all the tasks (including tasks whose task source is neither the handle fetch task source nor the handle functional event task source) from serviceWorkerGlobalScope's event loop's task queues without processing them. +
                    37. If there are any tasks, whose task source is either the handle fetch task source or the handle functional event task source, queued in serviceWorkerGlobalScope's event loop's task queues, queue them to serviceWorker's containing service worker registration's corresponding task queues in the same order using their original task sources, and discard all the tasks (including tasks whose task source is neither the handle fetch task source nor the handle functional event task source) from serviceWorkerGlobalScope's event loop's task queues without processing them.

                      This effectively means that the fetch events and the other functional events such as push events are backed up by the registration's task queues while the other tasks including message events are discarded.

                    38. Abort the script currently running in serviceWorker.
                    39. @@ -3300,7 +3200,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
                    40. Invoke Run Service Worker algorithm with activeWorker as the argument.
                    41. 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. Create a trusted event e that uses the {{FetchEvent}} interface, with the event type fetch, which does not bubble.
                      4. Let the request attribute of e be initialized to r.
                      5. Let the clientId attribute of e be initialized to client's id if request is not a non-subresource request, and to null otherwise.
                      6. 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.
                      7. @@ -3599,7 +3499,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/

                        A new service worker is replacing the current service worker, or the current service worker is being discarded due to an install failure.

  • -
  • Fire a simple event named statechange at workerObject.
  • +
  • Fire an event named statechange at workerObject.
  • @@ -3619,7 +3519,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
    1. Assert: client is not null.
    2. -
    3. Queue a task to fire a simple event named controllerchange at the ServiceWorkerContainer object client is associated with.
    4. +
    5. 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.

    diff --git a/docs/v1/index.html b/docs/v1/index.html index 9be6da08..7dbd75eb 100644 --- a/docs/v1/index.html +++ b/docs/v1/index.html @@ -1422,7 +1422,7 @@

    Service Workers 1

    -

    Editor’s Draft,

    +

    Editor’s Draft,

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

    A service worker has an associated id (an opaque string), which uniquely identifies itself during the lifetime of its containing service worker registration.

    A service worker is dispatched a set of lifecycle events, install and activate, and functional events including fetch.

    A service worker has an associated script resource (a script), which represents its own script resource. It is initially set to null. A script resource has an associated has ever been evaluated flag. It is initially unset. A script resource has an associated HTTPS state (an HTTPS state value). It is initially "none". A script resource has an associated referrer policy (a referrer policy). It is initially the empty string.

    -

    A service worker has an associated script resource map which is a List of the Record {[[key]], [[value]]} where [[key]] is a URL and [[value]] is a response.

    +

    A service worker has an associated script resource map which is a List of the Record {[[key]], [[value]]} where [[key]] is a URL and [[value]] is a response.

    A service worker has an associated skip waiting flag. Unless stated otherwise it is unset.

    A service worker has an associated imported scripts updated flag. It is initially unset.

    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.

    @@ -1757,7 +1757,7 @@

    service worker registration has an associated active worker (a service worker or null) whose state is either activating or activated. It is initially set to null.

    A service worker registration has an associated last update check time. It is initially set to null.

    A service worker registration has an associated uninstalling flag. It is initially unset.

    -

    A service worker registration has one or more task queues that back up the tasks from its active worker’s event loop’s corresponding task queues. (The target task sources for this back up operation are the handle fetch task source and the handle functional event task source.) The user agent dumps the active worker’s tasks to the service worker registration’s task queues when the active worker is terminated and re-queues those tasks to the active worker’s event loop’s corresponding task queues when the active worker spins off. Unlike the task queues owned by event loops, the service worker registration’s task queues are not processed by any event loops in and of itself.

    +

    A service worker registration has one or more task queues that back up the tasks from its active worker’s event loop’s corresponding task queues. (The target task sources for this back up operation are the handle fetch task source and the handle functional event task source.) The user agent dumps the active worker’s tasks to the service worker registration’s task queues when the active worker is terminated and re-queues those tasks to the active worker’s event loop’s corresponding task queues when the active worker spins off. Unlike the task queues owned by event loops, the service worker registration’s task queues are not processed by any event loops in and of itself.

    2.2.1. Lifetime

    A user agent must persistently keep a list of registered service worker registrations unless otherwise they are explicitly unregistered. A user agent has a scope to registration map that stores the entries of the tuple of service worker registration’s scope url and the corresponding service worker registration. The lifetime of service worker registrations is beyond that of the ServiceWorkerRegistration objects which represent them within the lifetime of their corresponding service worker clients.

    @@ -1871,7 +1871,7 @@

    <
  • Let destination be the ServiceWorkerGlobalScope object associated with serviceWorker.
  • Let targetRealm be destination’s Realm.
  • Let incumbentSettings be the incumbent settings object, and incumbentGlobal its global object. -
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps. +
  • Let cloneRecord be StructuredCloneWithTransfer(message, transfer, targetRealm). If this throws an exception, rethrow that exception and abort these steps.
  • Let clonedMessage be cloneRecord.[[Clone]].
  • Let newPorts be a new frozen array consisting of all MessagePort objects in cloneRecord.[[TransferList]], if any, maintaining their relative order.
  • @@ -1946,7 +1946,7 @@

    3.2.5. update()

    update() method must run these steps:

      -
    1. Let p be a promise. +
    2. Let p be a promise.
    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. @@ -1962,7 +1962,7 @@
  • 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 p be a promise.
    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. @@ -2095,9 +2095,9 @@
    -

    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:

    @@ -2843,7 +2843,7 @@

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

    +

    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:

    1. @@ -3013,10 +3013,10 @@

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

      Each origin has an associated name to cache map.

      @@ -3062,12 +3062,12 @@

      5.4. };

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

      +

      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:

        -
      1. Let promise be a new promise. +
      2. Let promise be a new promise.
      3. Run these substeps in parallel:
          @@ -3108,15 +3108,15 @@

          Request object, then:
          1. Set r to request’s request. -
          2. If r’s method is not `GET` and options.ignoreMethod is false, return a promise resolved with an empty array. +
          3. If r’s method is not `GET` and options.ignoreMethod is false, return a promise resolved with an empty array.
        1. Else if request is a string, then:
            -
          1. Set r to the associated 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. +
          2. Set r to the associated 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.
        -
      4. Let promise be a new promise. +
      5. Let promise be a new promise.
      6. Run these substeps in parallel:
          @@ -3169,12 +3169,12 @@

          Request in requests:
          1. Let r be request’s request. -
          2. If r’s url’s scheme is not one of "http" and "https", or r’s method is not `GET`, return a promise rejected with a TypeError. +
          3. If r’s url’s scheme is not one of "http" and "https", or r’s method is not `GET`, return a promise rejected with a TypeError.
        1. For each request in requests:
            -
          1. Let r be the associated 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. +
          2. Let r be the associated 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.
          3. If r’s url’s scheme is not one of "http" and "https", then:
              @@ -3183,7 +3183,7 @@

              initiator to "fetch" and destination to "subresource".
            1. Add a Request object associated with r to requestArray. -
            2. Let responsePromise be a new promise. +
            3. Let responsePromise be a new promise.
            4. Run the following substeps in parallel:
                @@ -3235,7 +3235,7 @@

                promise. +
              • Let responseBodyPromise be a new promise.
              • Run the following substeps in parallel:
                  @@ -3285,13 +3285,13 @@

                  Request object, then:
                  1. Set r to request’s request. -
                  2. If r’s url’s scheme is not one of "http" and "https", or r’s method is not `GET`, return a promise rejected with a TypeError. +
                  3. If r’s url’s scheme is not one of "http" and "https", or r’s method is not `GET`, return a promise rejected with a TypeError.
                1. Else if request is a string, then:
                    -
                  1. Set r to the associated 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. -
                  2. If r’s url’s scheme is not one of "http" and "https", return a promise rejected with a TypeError. +
                  3. Set r to the associated 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. +
                  4. If r’s url’s scheme is not one of "http" and "https", return a promise rejected with a TypeError.
                2. If response’s associated response’s header list contains a header named `Vary`, then: @@ -3300,10 +3300,10 @@

                  *", return a promise rejected with a TypeError. +
                3. If f matches "*", return a promise rejected with a TypeError.
            -
          4. If response is disturbed or locked, return a promise rejected with a TypeError. +
          5. If response is disturbed or locked, return a promise rejected with a TypeError.
          6. Let newResponse be a new Response object associated with response’s associated response and a new Headers object whose guard is response’s Headers' guard.
          7. If response’s body is non-null, run these substeps: @@ -3363,12 +3363,12 @@

            Request object, then:
            1. Set r to request’s request. -
            2. If r’s method is not `GET` and options.ignoreMethod is false, return a promise resolved with false. +
            3. If r’s method is not `GET` and options.ignoreMethod is false, return a promise resolved with false.
          8. Else if request is a string, then:
              -
            1. Set r to the associated 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. +
            2. Set r to the associated 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.
          9. Let operations be an empty array.
          10. Let o be an empty object representing a CacheBatchOperation dictionary. @@ -3389,7 +3389,7 @@

            5.4.7. keys(request, options)

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

              -
            1. Let promise be a new promise. +
            2. Let promise be a new promise.
            3. Run these substeps in parallel:
                @@ -3416,7 +3416,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. +
              1. Set r to the associated 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.
            4. Let requestResponseArray be the result of running Query Cache algorithm passing a Request object that represents r and options as the arguments.
            5. @@ -3442,7 +3442,7 @@

              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.

              +

              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.

              @@ -3453,15 +3453,15 @@

              options.cacheName is present, then:
              1. - Return a new promise p and run the following substeps in parallel: + Return a new promise p and run the following substeps in parallel:
                1. - For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order: + For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order:
                  1. 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.
                  @@ -3471,15 +3471,15 @@

                  Else:
                    -
                  1. Let p be a promise resolved with undefined. +
                  2. Let p be a promise resolved with undefined.
                  3. - For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order: + For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order:
                    1. Set 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).)
                  4. Return p. @@ -3491,10 +3491,10 @@

                    has(cacheName) method must run these steps:

                    1. - Return a promise p resolved with the result of running the following substeps: + Return a promise p resolved with the result of running the following substeps:
                      1. - For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order: + For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order:
                        1. If cacheName matches entry.[[key]], then: @@ -3510,12 +3510,12 @@

                          5.5.3. open(cacheName)

                          open(cacheName) method must run these steps:

                            -
                          1. Let p be a new promise. +
                          2. Let p be a new promise.
                          3. Run the following substeps:
                            1. - For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order: + For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order:
                              1. If cacheName matches entry.[[key]], then: @@ -3525,7 +3525,7 @@

                            2. Let cache be a new Cache object. -
                            3. 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. +
                            4. 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.
                            5. Resolve p with cache.
                          4. Return p. @@ -3542,7 +3542,7 @@

                            If cacheExists is true, then:
                              -
                            1. Delete a Record {[[key]], [[value]]} entry from its name to cache map where cacheName matches entry.[[key]]. +
                            2. Delete a Record {[[key]], [[value]]} entry from its name to cache map where cacheName matches entry.[[key]].
                            3. Return true.
                            4. Abort these steps.
                            @@ -3562,10 +3562,10 @@

                          5. Let resultArray be an empty array.
                          6. - Return a promise p resolved with the result of running the following substeps: + Return a promise p resolved with the result of running the following substeps:
                            1. - For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order: + For each Record {[[key]], [[value]]} entry of its name to cache map, in key insertion order:
                              1. Add entry.[[key]] to resultArray.
                              @@ -3690,14 +3690,14 @@

                              Appendix A: Algorithms

                              The following definitions are the user agent’s internal data structures used throughout the specification.

                              -

                              A scope to registration map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a scope url and [[value]] is a service worker registration.

                              +

                              A scope to registration map is a List of the Record {[[key]], [[value]]} where [[key]] is a string that represents a scope url and [[value]] is a service worker registration.

                              A job is an abstraction of one of register, update, and unregister request for a service worker registration.

                              A job has a job type, which is one of register, update, and unregister.

                              A job has a scope url (a URL).

                              A job has a script url (a URL).

                              A job has a worker type ("classic" or "module").

                              A job has a client (a service worker client). It is initially null.

                              -

                              A job has a promise (a promise). It is initially null.

                              +

                              A job has a promise (a promise). It is initially null.

                              A job has a list of equivalent jobs (a list of jobs). It is initially the empty list.

                              A job has a force bypass cache flag It is initially unset.

                              Two jobs are equivalent when their job type is the same and:

                              @@ -3714,7 +3714,7 @@

                              Crea
                              jobType, a job type
                              scopeURL, a URL
                              scriptURL, a URL -
                              promise, a promise +
                              promise, a promise
                              client, a service worker client
                              Output
                              job, a job @@ -3761,7 +3761,7 @@

                              Run Job
                              none
                                -
                              1. Assert: the job queue is not empty. +
                              2. Assert: the job queue is not empty.
                              3. Queue a task to run these steps:
                                  @@ -3783,7 +3783,7 @@

                                  Fini
                                  none
                                    -
                                  1. Assert: the top element in the job queue is job. +
                                  2. Assert: the top element in the job queue is job.
                                  3. Pop the top element from the job queue.
                                  4. If the job queue is not empty, invoke Run Job with the top element of the job queue.
                                  @@ -3830,7 +3830,7 @@

                                  Regist
                                  Input
                                  job, a job
                                  Output -
                                  promise, a promise +
                                  promise, a promise
                                  1. @@ -4034,15 +4034,15 @@

                                    In
                                  2. Let redundantWorker be null.
                                  3. Run the Update Registration State algorithm passing registration, "installing" and worker as the arguments.
                                  4. Run the Update Worker State algorithm passing registration’s installing worker and installing as the arguments. -
                                  5. Assert: job’s promise is not null. +
                                  6. Assert: job’s promise is not null.
                                  7. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration. -
                                  8. Queue a task to fire a simple 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. +
                                  9. 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.
                                  10. Let installingWorker be registration’s installing worker.
                                  11. Invoke Run Service Worker algorithm with installingWorker as the argument.
                                  12. 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: @@ -4129,7 +4129,7 @@

                                      Acti
                                    5. 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.
                                      @@ -4186,7 +4186,7 @@

                                      referrer policy to serviceWorker’s script resource’s referrer policy.
                                    6. Set workerGlobalScope’s type to serviceWorker’s type.
                                    7. Create a new WorkerLocation object and associate it with workerGlobalScope. -
                                    8. If serviceWorker is an active worker, and there are any tasks queued in serviceWorker’s containing service worker registration’s task queues, queue them to serviceWorker’s event loop’s task queues in the same order using their original task sources. +
                                    9. If serviceWorker is an active worker, and there are any tasks queued in serviceWorker’s containing service worker registration’s task queues, queue them to serviceWorker’s event loop’s task queues in the same order using their original task sources.
                                    10. If script is a classic script, then run the classic script script. Otherwise, it is a module script; run the module script script.

                                      In addition to the usual possibilities of returning a value or failing due to an exception, this could be prematurely aborted by the kill a worker or terminate a worker algorithms.

                                      @@ -4215,7 +4215,7 @@

                                      Let serviceWorkerGlobalScope be serviceWorker’s environment settings object’s global object.
                                    11. Set serviceWorkerGlobalScope’s closing flag to true.
                                    12. - If there are any tasks, whose task source is either the handle fetch task source or the handle functional event task source, queued in serviceWorkerGlobalScope’s event loop’s task queues, queue them to serviceWorker’s containing service worker registration’s corresponding task queues in the same order using their original task sources, and discard all the tasks (including tasks whose task source is neither the handle fetch task source nor the handle functional event task source) from serviceWorkerGlobalScope’s event loop’s task queues without processing them. + If there are any tasks, whose task source is either the handle fetch task source or the handle functional event task source, queued in serviceWorkerGlobalScope’s event loop’s task queues, queue them to serviceWorker’s containing service worker registration’s corresponding task queues in the same order using their original task sources, and discard all the tasks (including tasks whose task source is neither the handle fetch task source nor the handle functional event task source) from serviceWorkerGlobalScope’s event loop’s task queues without processing them.

                                      This effectively means that the fetch events and the other functional events such as push events are backed up by the registration’s task queues while the other tasks including message events are discarded.

                                    13. Abort the script currently running in serviceWorker.
                                    @@ -4271,7 +4271,7 @@

                                    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. Create a trusted event e that uses the FetchEvent interface, with the event type fetch, which does not bubble.
                                    3. Let the request attribute of e be initialized to r.
                                    4. Let the clientId attribute of e be initialized to client’s id if request is not a non-subresource request, and to null otherwise.
                                    5. 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. @@ -4321,8 +4321,8 @@

                                      Assert: a Record with the [[value]] equals to registration is contained in scope to registration map. -
                                    6. Assert: registration’s active worker is not null. +
                                    7. Assert: a Record with the [[value]] equals to registration is contained in scope to registration map. +
                                    8. Assert: registration’s active worker is not null.
                                    9. Let activeWorker be registration’s active worker.
                                    10. If activeWorker’s set of event types to handle does not contain the event type for this functional event, return. @@ -4364,7 +4364,7 @@

                                      Record {[[key]], [[value]]} entry of its scope to registration map: + For each Record {[[key]], [[value]]} entry of its scope to registration map:
                                      1. Let registration be entry.[[value]].
                                      2. @@ -4423,7 +4423,7 @@

                                        serialized scope with the exclude fragment flag set.
                                      3. Let registration be a new service worker registration whose scope url is set to scope. -
                                      4. Set a newly-created Record {[[key]]: scopeString, [[value]]: registration} to scope to registration map. +
                                      5. Set a newly-created Record {[[key]]: scopeString, [[value]]: registration} to scope to registration map.
                                      6. Return registration.

              @@ -4465,7 +4465,7 @@

              Update Registration State algorithm passing registration, "active" and null as the arguments.
            6. Run the Update Worker State algorithm passing redundantWorker and redundant as the arguments.
            -
          11. Delete a Record {[[key]], [[value]]} entry from scope to registration map where registration’s scope url is the result of parsing entry.[[key]]. +
          12. Delete a Record {[[key]], [[value]]} entry from scope to registration map where registration’s scope url is the result of parsing entry.[[key]].
      @@ -4537,7 +4537,7 @@

      Up
      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 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" @@ -4545,7 +4545,7 @@

      Up
      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 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" @@ -4555,7 +4555,7 @@

      Up "redundant"

      A new service worker is replacing the current service worker, or the current service worker is being discarded due to an install failure.

      -
    2. Fire a simple event named statechange at workerObject. +
    3. Fire an event named statechange at workerObject.

    The task must use workerObject’s relevant settings object’s responsible event loop and the DOM manipulation task source.

    @@ -4570,8 +4570,8 @@

    None
      -
    1. Assert: client is not null. -
    2. Queue a task to fire a simple event named controllerchange at the ServiceWorkerContainer object client is associated with. +
    3. Assert: client is not null. +
    4. 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.

    @@ -4611,7 +4611,7 @@

    serialized scope with the exclude fragment flag set.
  • Let registration be null.
  • - For each Record {[[key]], [[value]]} entry of its scope to registration map: + For each Record {[[key]], [[value]]} entry of its scope to registration map:
    1. If scopeString matches entry.[[key]], set registration to entry.[[value]].
    @@ -4760,10 +4760,10 @@

    CacheBatchOperation dictionary objects
    Output -
    promise, a promise resolves with an array of Response objects. +
    promise, a promise resolves with an array of Response objects.
      -
    1. Let p be a promise resolved with no value. +
    2. Let p be a promise resolved with no value.
    3. Return the result of transforming p with a fulfillment handler that performs the following substeps in parallel:
        @@ -5305,6 +5305,7 @@

        dispatch flag
      1. event
      2. event listener +
      3. fire an event
      4. stop immediate propagation flag
      5. stop propagation flag @@ -5316,12 +5317,12 @@

        [ECMASCRIPT] defines the following terms:
      6. [FETCH] defines the following terms: @@ -5398,6 +5399,7 @@

        MessagePort
      7. Navigator
      8. SharedWorkerGlobalScope +
      9. StructuredCloneWithTransfer
      10. Window
      11. WindowOrWorkerGlobalScope
      12. Worker @@ -5406,31 +5408,30 @@

        WorkerNavigator
      13. WorkerType
      14. a browsing context is discarded -
      15. about:blank
      16. active document
      17. api base url
      18. api url character encoding
      19. application cache -
      20. auxiliary browsing contexts +
      21. auxiliary browsing context
      22. browsing context
      23. classic script
      24. creation url
      25. discard a document
      26. dom manipulation task source
      27. environment settings object +
      28. event handler
      29. event handler event type
      30. event handler idl attribute -
      31. event handlers -
      32. event loops +
      33. event loop
      34. exceptions enabled flag
      35. fetch a classic worker script
      36. fetch a module worker script tree -
      37. fire a simple event
      38. focusing steps -
      39. global object +
      40. global object (for Realm) +
      41. global object (for environment settings object)
      42. has focus steps +
      43. https state (for WorkerGlobalScope)
      44. https state (for environment settings object) -
      45. https state (for workerglobalscope)
      46. import scripts into worker global scope
      47. importScripts(urls)
      48. in parallel @@ -5446,9 +5447,10 @@

        parent browsing context
      49. perform the fetch
      50. queue a task +
      51. realm
      52. realm execution context +
      53. referrer policy (for WorkerGlobalScope)
      54. referrer policy (for environment settings object) -
      55. referrer policy (for workerglobalscope)
      56. relevant global object
      57. relevant realm
      58. relevant settings object @@ -5462,13 +5464,10 @@

        script
      59. shared workers
      60. source browsing context -
      61. structuredclonewithtransfer +
      62. task
      63. task queue
      64. task source -
      65. tasks
      66. terminate a worker -
      67. the global object's realm -
      68. the realm's global object
      69. the worker's documents
      70. top-level browsing context
      71. triggered by user activation