From 9af153e9d333f3ec6a0437271cfe096714edf57b Mon Sep 17 00:00:00 2001 From: Jungkee Song Date: Tue, 6 Dec 2016 14:14:15 +0900 Subject: [PATCH] Fetch service worker scripts with "no-cache" by default This introduces service worker registration's use cache field and its related APIs: options.useCache to register method and registration.useCache for ServiceWorkerRegistration objects. This changes the default cache mode of fetching SW scripts to "no-cache". After the change, 24 hours limit and job's force bypass cache flag rules are still enforced. register() method's options value set to { useCache: true } re-enables the previous default behavior provided before this change. Fixes #893. --- docs/index.bs | 58 +++++++--- docs/index.html | 270 ++++++++++++++++++++++++++++++--------------- docs/v1/index.bs | 43 +++++--- docs/v1/index.html | 256 ++++++++++++++++++++++++++---------------- 4 files changed, 409 insertions(+), 218 deletions(-) diff --git a/docs/index.bs b/docs/index.bs index a54d097a..1fba3762 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -187,8 +187,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe A [=/service worker registration=] has an associated scope url (a [=/URL=]). - A [=/service worker registration=] has an associated registering script url (a [=/URL=]). - A [=/service worker registration=] has an associated installing worker (a [=/service worker=] or null) whose [=service worker/state=] is *installing*. It is initially set to null. A [=/service worker registration=] has an associated waiting worker (a [=/service worker=] or null) whose [=service worker/state=] is *installed*. It is initially set to null. @@ -197,6 +195,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe A [=/service worker registration=] has an associated last update check time. It is initially set to null. + A [=/service worker registration=] has an associated use cache (a boolean). It is initially set to false. + 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 [=service worker registration/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 [=service worker registration/task queues=] are not processed by any event loops in and of itself. @@ -391,6 +391,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe readonly attribute ServiceWorker? active; readonly attribute USVString scope; + readonly attribute boolean useCache; [NewObject] Promise<void> update(); [NewObject] Promise<boolean> unregister(); @@ -436,6 +437,12 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe +
+

{{ServiceWorkerRegistration/useCache}}

+ + The useCache attribute *must* return [=ServiceWorkerRegistration/service worker registration=]'s [=service worker registration/use cache=]. +
+

{{ServiceWorkerRegistration/update()}}

@@ -529,6 +536,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe dictionary RegistrationOptions { USVString scope; WorkerType type = "classic"; + boolean useCache = false; }; @@ -590,7 +598,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Let |scriptURL| be the result of parsing |scriptURL| with the context object's relevant settings object's API base URL. 1. Let |scopeURL| be null. 1. 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. - 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |p|, |client|, |client|'s creation URL and |options|.{{RegistrationOptions/type}}. + 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |p|, |client|, |client|'s creation URL, |options|.{{RegistrationOptions/type}}, and |options|.{{RegistrationOptions/useCache}}. 1. Return |p|.
@@ -1636,7 +1644,9 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. If the "scope" target attribute of the Link header is present, set |scopeURL| to the result of parsing the "scope" target attribute with |scriptURL|. 1. Let |workerType| be the "workertype" target attribute of the Link header, or "classic" if no such attribute is present. 1. If |workerType| is not a valid {{WorkerType}} value, abort these steps. - 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, a new promise, null, |contextURL| and |workerType|. + 1. Let |useCache| be the "usecache" target attribute of the Link header, or false if no such attribute is present. + 1. If |useCache| is not a valid boolean value, abort these steps. + 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, a new promise, null, |contextURL|, |workerType|, and |useCache|. When a serviceworker link's <{link}> element is inserted into a document, a serviceworker link is created on a <{link}> element that is already in a document tree, or the <{link/href}> or <{link/scope}> attributes of the <{link}> element of a serviceworker link is changed, the user agent *should* run these steps: @@ -1648,8 +1658,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. If the <{link/scope}> attribute is present, set |scopeURL| to the result of parsing the <{link/scope}> attribute with the <{link}> element's node document's document base URL. 1. Let |workerType| be the <{link/workertype}> attribute, or "classic" if the <{link/workertype}> attribute is omitted. 1. If |workerType| is not a valid {{WorkerType}} value, queue a task to fire an event named error at the <{link}> element, and abort these steps. + 1. Let |useCache| be the <{link/usecache}> attribute, or false if the <{link/usecache}> attribute is omitted. + 1. If |useCache| is not a valid boolean value, queue a task to fire an event named error at the <{link}> element, and abort these steps. 1. Let |promise| be a new promise. - 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |promise|, |client|, |client|'s creation URL and |workerType|. + 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |promise|, |client|, |client|'s creation URL, |workerType|, and |useCache|. 1. Run the following substeps in parallel: 1. Wait until |promise| settles. 1. If |promise| rejected, queue a task to fire an event named error at the <{link}> element. @@ -1686,12 +1698,15 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe partial interface HTMLLinkElement { [CEReactions] attribute USVString scope; [CEReactions] attribute WorkerType workerType; + [CEReactions] attribute boolean useCache; }; The scope IDL attribute must reflect the element's scope content attribute. The workerType IDL attribute must reflect the element's workertype content attribute. + + The useCache IDL attribute must reflect the element's usecache content attribute. @@ -2247,6 +2262,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe A job has a worker type ("classic" or "module"). + A job has a use cache (a boolean). + A job has a client (a [=/service worker client=]). It is initially null. A job has a referrer (a [=/URL=] or null). @@ -2312,7 +2329,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe : Output :: none - 1. Assert: the job queue is not empty. + 1. Assert: the job queue is not empty. 1. Queue a task to run these steps: 1. Let |job| be the element in the front of the job queue. 1. If |job|'s job type is *register*, run Register with |job| in parallel. @@ -2331,7 +2348,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe : Output :: none - 1. Assert: the top element in the job queue is |job|. + 1. Assert: the top element in the job queue is |job|. 1. Pop the top element from the job queue. 1. If the job queue is not empty, invoke Run Job with the top element of the job queue. @@ -2374,6 +2391,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe :: |client|, a [=/service worker client=] :: |referrer|, a [=/URL=] :: |workerType|, a worker type + :: |useCache|, a boolean : Output :: none @@ -2388,7 +2406,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. If |scopeURL|'s [=url/scheme=] is not one of "http" and "https", reject |promise| with a TypeError and abort these steps. 1. If any of the strings in |scopeURL|'s [=url/path=] contains either ASCII case-insensitive "%2f" or ASCII case-insensitive "%5c", reject |promise| with a TypeError and abort these steps. 1. Let |job| be the result of running [=Create Job=] with *register*, |scopeURL|, |scriptURL|, |promise|, and |client|. - 1. Set |job|'s worker type to |workerType|. + 1. Set |job|'s [=job/worker type=] to |workerType|. + 1. Set |job|'s [=job/use cache=] to |useCache|. 1. Set |job|'s [=job/referrer=] to |referrer|. 1. Invoke [=Schedule Job=] with |job|. @@ -2414,11 +2433,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. If |registration| is not null, then: 1. If |registration|'s uninstalling flag is set, unset it. 1. Let |newestWorker| be the result of running the Get Newest Worker algorithm passing |registration| as the argument. - 1. If |newestWorker| is not null and |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=] with the *exclude fragments flag* set, then: + 1. If |newestWorker| is not null, |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=] with the *exclude fragments flag* set, and |job|'s [=job/use cache=]'s value equals |registration|'s [=service worker registration/use cache=]'s value, then: 1. Invoke Resolve Job Promise with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|. 1. Invoke Finish Job with |job| and abort these steps. 1. Else: - 1. Invoke Set Registration algorithm passing |job|'s [=job/scope url=] as its argument. + 1. Invoke Set Registration algorithm with |job|'s [=job/scope url=] and |job|'s [=job/use cache=]. 1. Invoke Update algorithm passing |job| as the argument. @@ -2454,10 +2473,12 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers. 1. Set |request|'s skip-service-worker flag and |request|'s [=request/redirect mode=] to "error". - 1. If |newestWorker| is not null and |registration|'s last update check time is not null, then: - 1. If the time difference in seconds calculated by the current time minus |registration|'s last update check time is greater than 86400, or *force bypass cache flag* is set, set |request|'s [=request/cache mode=] to "reload". + 1. Set |request|'s [=request/cache mode=] to "no-cache" if any of the following are true: + * |registration|'s [=service worker registration/use cache=] is false. + * |job|'s [=force bypass cache flag=] is set. + * |newestWorker| is not null, and |registration|'s [=last update check time=] is not null and the time difference in seconds calculated by the current time minus |registration|’s [=last update check time=] is greater than 86400. - Note: Even if the cache mode is not set to "reload", the user agent obeys Cache-Control header's max-age value in the network layer to determine if it should bypass the browser cache. + Note: Even if the cache mode is not set to "no-cache", the user agent obeys Cache-Control header's max-age value in the network layer to determine if it should bypass the browser cache. 1. [=/Fetch=] |request|, and asynchronously wait to run the remaining steps as part of fetch's process response for the [=/response=] |response|. 1. Extract a MIME type from the |response|'s [=response/header list=]. If this MIME type (ignoring parameters) is not one of text/javascript, application/x-javascript, and application/javascript, then: @@ -2554,7 +2575,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Let |redundantWorker| be null. 1. Run the Update Registration State algorithm passing |registration|, "installing" and |worker| as the arguments. 1. Run the Update Worker State algorithm passing |registration|'s installing worker and *installing* as the arguments. - 1. Assert: |job|'s [=job/job promise=] is not null. + 1. Assert: |job|'s [=job/job promise=] is not null. 1. Invoke Resolve Job Promise with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|. 1. 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 [=service worker registration/scope url=] and all the [=/service workers=] whose containing service worker registration is |registration|. 1. Let |installingWorker| be |registration|'s installing worker. @@ -2904,8 +2925,8 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe : Output :: None - 1. Assert: scope to registration map contains a value equal to |registration|. - 1. Assert: |registration|'s active worker is not null. + 1. Assert: scope to registration map contains a value equal to |registration|. + 1. Assert: |registration|'s active worker is not null. 1. Let |activeWorker| be |registration|'s active worker. 1. If |activeWorker|'s set of event types to handle does not contain |event|'s {{Event/type}}, then: 1. Return and continue running these steps in parallel. @@ -2989,12 +3010,13 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe : Input :: |scope|, a [=/URL=] + :: |useCache|, a boolean : Output :: |registration|, a [=/service worker registration=] 1. Run the following steps atomically. 1. Let |scopeString| be serialized |scope| with the *exclude fragment flag* set. - 1. Let |registration| be a new [=/service worker registration=] whose [=service worker registration/scope url=] is set to |scope|. + 1. Let |registration| be a new [=/service worker registration=] whose [=service worker registration/scope url=] is set to |scope| and [=service worker registration/use cache=] is set to |useCache|. 1. [=map/Set=] scope to registration map[|scopeString|] to |registration|. 1. Return |registration|. @@ -3110,7 +3132,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe : Output :: None - 1. Assert: |client| is not null. + 1. Assert: |client| is not null. 1. If |client| is a type of environment settings object, queue a task to fire an event named controllerchange at the {{ServiceWorkerContainer}} object |client| is [=ServiceWorkerContainer/service worker client|associated=] with. The task *must* use |client|'s responsible event loop and the DOM manipulation task source. diff --git a/docs/index.html b/docs/index.html index b0efff89..81e5fea6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1424,7 +1424,7 @@

Service Workers Nightly

-

Editor’s Draft,

+

Editor’s Draft,

This version: @@ -1512,9 +1512,10 @@

Table of Contents

  • 3.2.2 waiting
  • 3.2.3 active
  • 3.2.4 scope -
  • 3.2.5 update() -
  • 3.2.6 unregister() -
  • 3.2.7 Event handler +
  • 3.2.5 useCache +
  • 3.2.6 update() +
  • 3.2.7 unregister() +
  • 3.2.8 Event handler
  • 3.3 navigator.serviceWorker
  • @@ -1778,11 +1779,11 @@

    2.2. Service Worker Registration

    A service worker registration is a tuple of a scope url and a set of service workers, an installing worker, a waiting worker, and an active worker. A user agent may enable many service worker registrations at a single origin so long as the scope url of the service worker registration differs. A service worker registration of an identical scope url when one already exists in the user agent causes the existing service worker registration to be replaced.

    A service worker registration has an associated scope url (a URL).

    -

    A service worker registration has an associated registering script url (a URL).

    -

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

    -

    A service worker registration has an associated waiting worker (a service worker or null) whose state is installed. It is initially set to null.

    -

    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 installing worker (a service worker or null) whose state is installing. It is initially set to null.

    +

    A service worker registration has an associated waiting worker (a service worker or null) whose state is installed. It is initially set to null.

    +

    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 use cache (a boolean). It is initially set to false.

    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.

    @@ -1956,6 +1957,7 @@

    readonly attribute ServiceWorker? active; readonly attribute USVString scope; + readonly attribute boolean useCache; [NewObject] Promise<void> update(); [NewObject] Promise<boolean> unregister(); @@ -1985,14 +1987,18 @@

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

    In the example in §3.1.1 scriptURL, the value of registration.scope, obtained from navigator.serviceWorker.ready.then(registration => console.log(registration.scope)) for example, will be "https://example.com/".

    +
    +

    3.2.5. useCache

    +

    The useCache attribute must return service worker registration's use cache.

    +
    -

    3.2.5. update()

    +

    3.2.6. update()

    update() method must run these steps:

    1. Let p be a promise.

    2. -

      Let registration be the service worker registration.

      +

      Let registration be the service worker registration.

    3. Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.

    4. @@ -2010,14 +2016,14 @@

      -

      +

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

        +

        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.

      3. Invoke Schedule Job with job.

      4. @@ -2025,7 +2031,7 @@ +

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

        @@ -2074,6 +2080,7 @@

        dictionary RegistrationOptions { USVString scope; WorkerType type = "classic"; + boolean useCache = false; };

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

        @@ -2148,7 +2155,7 @@

        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:

        @@ -3495,7 +3502,11 @@
        @@ -2049,7 +2055,8 @@

        dictionary RegistrationOptions { USVString scope; - WorkerType type = "classic"; + WorkerType type = "classic"; + boolean useCache = false; };

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

        @@ -2140,6 +2147,10 @@

        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:

        @@ -4035,19 +4046,20 @@

        Appendix A: Al

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

        +

        A job has a use cache (a boolean).

        +

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

        +

        A job has a job 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:

        +

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

        -

        A job queue is a thread safe queue used to synchronize the set of concurrent jobs. The job queue contains jobs as its elements. The job queue should satisfy the general properties of FIFO queue. A user agent must maintain a separate job queue for each service worker registration keyed by its scope url. A job queue is initially empty. Unless stated otherwise, the job queue referenced from the algorithm steps is a job queue for the job’s scope url.

        +

        A job queue is a thread safe queue used to synchronize the set of concurrent jobs. The job queue contains jobs as its elements. The job queue should satisfy the general properties of FIFO queue. A user agent must maintain a separate job queue for each service worker registration keyed by its scope url. A job queue is initially empty. Unless stated otherwise, the job queue referenced from the algorithm steps is a job queue for the job’s scope url.

        Create Job

        @@ -4066,11 +4078,11 @@

        Output

        -

        job, a job

        +

        job, a job

        1. -

          Let job be a new job.

          +

          Let job be a new job.

        2. Set job’s job type to jobType.

        3. @@ -4091,7 +4103,7 @@

          Input

          -

          job, a job

          +

          job, a job

          Output

          @@ -4130,7 +4142,7 @@

          1. -

            Assert: the job queue is not empty.

            +

            Assert: the job queue is not empty.

          2. Queue a task to run these steps:

              @@ -4152,7 +4164,7 @@

              Input

              -

              job, a job

              +

              job, a job

              Output

              @@ -4160,7 +4172,7 @@

              1. -

                Assert: the top element in the job queue is job.

                +

                Assert: the top element in the job queue is job.

              2. Pop the top element from the job queue.

              3. @@ -4173,7 +4185,7 @@

                Input

                -

                job, a job

                +

                job, a job

                value, any

                @@ -4198,7 +4210,7 @@

                Input

                -

                job, a job

                +

                job, a job

                reason, an exception

                @@ -4223,7 +4235,7 @@

                Input

                -

                job, a job

                +

                job, a job

                Output

                @@ -4264,7 +4276,7 @@

                Let newestWorker be the result of running the Get Newest Worker algorithm passing registration as the argument.

              4. -

                If newestWorker is not null and job’s script url equals newestWorker’s script url with the exclude fragments flag set, then:

                +

                If newestWorker is not null, job’s script url equals newestWorker’s script url with the exclude fragments flag set, and job’s use cache's value equals registration’s use cache's value, then:

                1. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration.

                  @@ -4276,7 +4288,7 @@

                  Else:

                  1. -

                    Invoke Set Registration algorithm passing job’s scope url as its argument.

                    +

                    Invoke Set Registration algorithm with job’s scope url and job’s use cache.

                2. Invoke Update algorithm passing job as the argument.

                  @@ -4288,7 +4300,7 @@

                  Input

                  -

                  job, a job

                  +

                  job, a job

                  Output

                  @@ -4320,7 +4332,7 @@

                  Let referrerPolicy be the empty string.

                3. -

                  Switching on job’s worker type, run these substeps with the following options:

                  +

                  Switching on job’s worker type, run these substeps with the following options:

                  "classic"

                  @@ -4339,12 +4351,16 @@

                  Set request’s skip-service-worker flag and request’s redirect mode to "error".

                4. -

                  If newestWorker is not null and registration’s last update check time is not null, then:

                  -
                    +

                    Set request’s cache mode to "no-cache" if any of the following are true:

                    +
                    • -

                      If the time difference in seconds calculated by the current time minus registration’s last update check time is greater than 86400, or force bypass cache flag is set, set request’s cache mode to "reload".

                      -
                  -

                  Note: Even if the cache mode is not set to "reload", the user agent obeys Cache-Control header’s max-age value in the network layer to determine if it should bypass the browser cache.

                  +

                  registration’s use cache is false.

                  +
                5. +

                  job’s force bypass cache flag is set.

                  +
                6. +

                  newestWorker is not null, and registration’s last update check time is not null and the time difference in seconds calculated by the current time minus registration’s last update check time is greater than 86400.

                  + +

                  Note: Even if the cache mode is not set to "no-cache", the user agent obeys Cache-Control header’s max-age value in the network layer to determine if it should bypass the browser cache.

                7. Fetch request, and asynchronously wait to run the remaining steps as part of fetch’s process response for the response response.

                8. @@ -4431,7 +4447,7 @@

                  Generate a unique opaque string and set worker’s id to the value.

                9. -

                  Set worker’s script url to job’s script url, worker’s script resource to script, and worker’s type to job’s worker type.

                  +

                  Set worker’s script url to job’s script url, worker’s script resource to script, and worker’s type to job’s worker type.

                10. Set worker’s script resource’s HTTPS state to httpsState.

                11. @@ -4477,9 +4493,9 @@

                  Let job be the result of running Create Job with update, registration’s scope url, newestWorker’s script url, null, and null.

                12. -

                  Set job’s worker type to newestWorker’s type.

                  +

                  Set job’s worker type to newestWorker’s type.

                13. -

                  Set job’s force bypass cache flag if its force bypass cache flag is set.

                  +

                  Set job’s force bypass cache flag if its force bypass cache flag is set.

                14. Invoke Schedule Job with job.

                @@ -4490,7 +4506,7 @@

                Input

                -

                job, a job

                +

                job, a job

                worker, a service worker

                @@ -4512,7 +4528,7 @@

                Run the Update Worker State algorithm passing registration’s installing worker and installing as the arguments.

              5. -

                Assert: job’s job promise is not null.

                +

                Assert: job’s job promise is not null.

              6. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration.

              7. @@ -5013,9 +5029,9 @@

                -

                Assert: scope to registration map contains a value equal to registration.

                +

                Assert: scope to registration map contains a value equal to registration.

              8. -

                Assert: registration’s active worker is not null.

                +

                Assert: registration’s active worker is not null.

              9. Let activeWorker be registration’s active worker.

              10. @@ -5115,7 +5131,7 @@

                Input

                -

                job, a job

                +

                job, a job

                Output

                @@ -5158,6 +5174,8 @@

                scope, a URL

                +
                +

                useCache, a boolean

                Output

                @@ -5169,7 +5187,7 @@

                Let scopeString be serialized scope with the exclude fragment flag set.

              11. -

                Let registration be a new service worker registration whose scope url is set to scope.

                +

                Let registration be a new service worker registration whose scope url is set to scope and use cache is set to useCache.

              12. Set scope to registration map[scopeString] to registration.

              13. @@ -5374,7 +5392,7 @@

                1. -

                  Assert: client is not null.

                  +

                  Assert: client is not null.

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

                @@ -6050,7 +6068,7 @@

                attribute for ServiceWorkerGlobalScope, in §4.1.4
              14. onstatechange, in §3.1.4 -
              15. onupdatefound, in §3.2.7 +
              16. onupdatefound, in §3.2.8
              17. open(cacheName), in §5.5.3
              18. openWindow(url), in §4.3.3
              19. options, in §5.4 @@ -6084,7 +6102,6 @@

                redundant, in §3.1
              20. referrer policy, in §2.1
              21. Register, in §Unnumbered section -
              22. registering script url, in §2.2
              23. register(scriptURL), in §3.4.3
              24. register(scriptURL, options), in §3.4.3
              25. @@ -6209,14 +6226,26 @@

                dict-member for CacheBatchOperation, in §5.4
              26. uninstalling flag, in §2.2 -
              27. unregister(), in §3.2.6 +
              28. unregister(), in §3.2.7
              29. Unregister, in §Unnumbered section -
              30. update(), in §3.2.5 +
              31. update(), in §3.2.6
              32. Update, in §Unnumbered section
              33. updatefound, in §3.5
              34. Update Registration State, in §Unnumbered section
              35. Update Worker State, in §Unnumbered section
              36. url, in §4.2.1 +
              37. + use cache + +
              38. + useCache +
              39. used, in §2.4
              40. uses, in §2.4
              41. using, in §2.4 @@ -6267,7 +6296,6 @@

                [ECMASCRIPT] defines the following terms: + + +