From 9889d02307a53b1bc0f6f8e85c8fef8a834f2282 Mon Sep 17 00:00:00 2001 From: Jungkee Song Date: Thu, 12 Jan 2017 15:29:13 +0900 Subject: [PATCH 1/3] Use correct values for Resolve/Reject Job Promise This changes Resolve Job Promise/Reject Job Promise algorithms and their call sites to use correct fulfillment values/rejection reasons for equivalent job promises by specifying the associated realms. Fixes #829. --- docs/index.bs | 31 ++++-- docs/index.html | 269 ++++++++++++++++++++++++--------------------- docs/v1/index.bs | 31 ++++-- docs/v1/index.html | 265 ++++++++++++++++++++++++-------------------- 4 files changed, 330 insertions(+), 266 deletions(-) diff --git a/docs/index.bs b/docs/index.bs index 82e16809..a5fcb7c5 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -2521,28 +2521,37 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe

Resolve Job Promise

: Input - :: |job|, a job + :: |job|, a [=job=] :: |value|, any : Output :: none - 1. If |job|'s [=job/client=] is not null, queue a task to resolve |job|'s [=job/job promise=] with |value| on |job|'s [=job/client=]'s responsible event loop using the DOM manipulation task source as the task source. + 1. Let |convertedValue| be null. + 1. If |job|'s [=job/client=] is not null, [=queue a task=], on |job|'s [=job/client=]'s [=responsible event loop=] using the [=DOM manipulation task source=], to run the following substeps: + 1. If |job|'s [=job/job type=] is either *register* or *update*, set |convertedValue| to the {{ServiceWorkerRegistration}} object that represents |value|, in |job|'s [=job/client=]'s [=environment settings object/Realm=]. + 1. Else, set |convertedValue| to |value|, in |job|'s [=job/client=]'s [=environment settings object/Realm=]. + 1. Resolve |job|'s [=job/job promise=] with |convertedValue|. 1. For each |equivalentJob| in |job|'s list of equivalent jobs: - 1. If |equivalentJob|'s [=job/client=] is not null, queue a task to resolve |equivalentJob|'s [=job/job promise=] with |value| on |equivalentJob|'s [=job/client=]'s responsible event loop using the DOM manipulation task source as the task source. + 1. If |equivalentJob|'s [=job/client=] is null, continue to the next iteration of the loop. + 1. [=Queue a task=], on |equivalentJob|'s [=job/client=]'s [=responsible event loop=] using the [=DOM manipulation task source=], to run the following substeps: + 1. If |equivalentJob|'s [=job/job type=] is either *register* or *update*, set |convertedValue| to the {{ServiceWorkerRegistration}} object that represents |value|, in |equivalentJob|'s [=job/client=]'s [=environment settings object/Realm=]. + 1. Else, set |convertedValue| to |value|, in |equivalentJob|'s [=job/client=]'s [=environment settings object/Realm=]. + 1. Resolve |equivalentJob|'s [=job/job promise=] with |convertedValue|.

Reject Job Promise

: Input - :: |job|, a job - :: |reason|, an exception + :: |job|, a [=job=] + :: |reason|, an [=exception=] : Output :: none - 1. If |job|'s [=job/client=] is not null, queue a task to reject |job|'s [=job/job promise=] with |reason| on |job|'s [=job/client=]'s responsible event loop using the DOM manipulation task source as the task source. - 1. For each |equivalentJob| in |job|'s list of equivalent jobs: - 1. If |equivalentJob|'s [=job/client=] is not null, queue a task to reject |equivalentJob|'s [=job/job promise=] with |reason| on |equivalentJob|'s [=job/client=]'s responsible event loop using the DOM manipulation task source as the task source. + 1. If |job|'s [=job/client=] is not null, [=queue a task=], on |job|'s [=job/client=]'s [=responsible event loop=] using the [=DOM manipulation task source=], to reject |job|'s [=job/job promise=] with an exception that is a copy of |reason|, in |job|'s [=job/client=]'s [=environment settings object/Realm=]. + 1. For each |equivalentJob| in |job|'s [=list of equivalent jobs=]: + 1. If |equivalentJob|'s [=job/client=] is null, continue to the next iteration of the loop: + 1. [=Queue a task=], on |equivalentJob|'s [=job/client=]'s [=responsible event loop=] using the [=DOM manipulation task source=], to reject |equivalentJob|'s [=job/job promise=] with an exception that is a copy of |reason|, in |equivalentJob|'s [=job/client=]'s [=environment settings object/Realm=].
@@ -2598,7 +2607,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 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, |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=] with the *exclude fragments flag* set, and |job|'s [=job/update via cache mode=]'s value equals |registration|'s [=service worker registration/update via cache mode=], then: - 1. Invoke Resolve Job Promise with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|. + 1. Invoke [=Resolve Job Promise=] with |job| and |registration|. 1. Invoke Finish Job with |job| and abort these steps. 1. Else: 1. Invoke Set Registration algorithm with |job|'s [=job/scope url=] and |job|'s [=job/update via cache mode=]. @@ -2688,7 +2697,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe Else, continue the rest of these steps after the algorithm's asynchronous completion, with |script| being the asynchronous completion value. 1. If |newestWorker| is not null, |newestWorker|'s [=service worker/script url=] [=url/equals=] |job|'s [=job/script url=] with the *exclude fragments flag* set, and |script|'s [=source text=] is a byte-for-byte match with |newestWorker|'s [=script resource=]'s [=source text=], if |script| is a [=classic script=], and |script|'s [=module script/module record=]'s \[[ECMAScriptCode]] is a byte-for-byte match with |newestWorker|'s [=script resource=]'s [=module script/module record=]'s \[[ECMAScriptCode]] otherwise, then: - 1. Invoke Resolve Job Promise with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|. + 1. Invoke [=Resolve Job Promise=] with |job| and |registration|. 1. Invoke Finish Job with |job| and abort these steps. 1. Else: 1. Let |worker| be a new [=/service worker=]. @@ -2741,7 +2750,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 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. Invoke Resolve Job Promise with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|. + 1. Invoke [=Resolve Job Promise=] with |job| and |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. 1. Invoke Run Service Worker algorithm given |installingWorker|, and with the *force bypass cache for importscripts flag* set if |job|'s [=job/force bypass cache flag=] is set. diff --git a/docs/index.html b/docs/index.html index 358a491f..cdf787d2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1177,7 +1177,7 @@ } } - + +.highlight:not(.idl) { background: hsl(24, 20%, 95%); } +code.highlight { padding: .1em; border-radius: .3em; } +pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; } +.highlight .c { color: #708090 } /* Comment */ +.highlight .k { color: #990055 } /* Keyword */ +.highlight .l { color: #000000 } /* Literal */ +.highlight .n { color: #0077aa } /* Name */ +.highlight .o { color: #999999 } /* Operator */ +.highlight .p { color: #999999 } /* Punctuation */ +.highlight .cm { color: #708090 } /* Comment.Multiline */ +.highlight .cp { color: #708090 } /* Comment.Preproc */ +.highlight .c1 { color: #708090 } /* Comment.Single */ +.highlight .cs { color: #708090 } /* Comment.Special */ +.highlight .kc { color: #990055 } /* Keyword.Constant */ +.highlight .kd { color: #990055 } /* Keyword.Declaration */ +.highlight .kn { color: #990055 } /* Keyword.Namespace */ +.highlight .kp { color: #990055 } /* Keyword.Pseudo */ +.highlight .kr { color: #990055 } /* Keyword.Reserved */ +.highlight .kt { color: #990055 } /* Keyword.Type */ +.highlight .ld { color: #000000 } /* Literal.Date */ +.highlight .m { color: #000000 } /* Literal.Number */ +.highlight .s { color: #a67f59 } /* Literal.String */ +.highlight .na { color: #0077aa } /* Name.Attribute */ +.highlight .nc { color: #0077aa } /* Name.Class */ +.highlight .no { color: #0077aa } /* Name.Constant */ +.highlight .nd { color: #0077aa } /* Name.Decorator */ +.highlight .ni { color: #0077aa } /* Name.Entity */ +.highlight .ne { color: #0077aa } /* Name.Exception */ +.highlight .nf { color: #0077aa } /* Name.Function */ +.highlight .nl { color: #0077aa } /* Name.Label */ +.highlight .nn { color: #0077aa } /* Name.Namespace */ +.highlight .py { color: #0077aa } /* Name.Property */ +.highlight .nt { color: #669900 } /* Name.Tag */ +.highlight .nv { color: #222222 } /* Name.Variable */ +.highlight .ow { color: #999999 } /* Operator.Word */ +.highlight .mb { color: #000000 } /* Literal.Number.Bin */ +.highlight .mf { color: #000000 } /* Literal.Number.Float */ +.highlight .mh { color: #000000 } /* Literal.Number.Hex */ +.highlight .mi { color: #000000 } /* Literal.Number.Integer */ +.highlight .mo { color: #000000 } /* Literal.Number.Oct */ +.highlight .sb { color: #a67f59 } /* Literal.String.Backtick */ +.highlight .sc { color: #a67f59 } /* Literal.String.Char */ +.highlight .sd { color: #a67f59 } /* Literal.String.Doc */ +.highlight .s2 { color: #a67f59 } /* Literal.String.Double */ +.highlight .se { color: #a67f59 } /* Literal.String.Escape */ +.highlight .sh { color: #a67f59 } /* Literal.String.Heredoc */ +.highlight .si { color: #a67f59 } /* Literal.String.Interpol */ +.highlight .sx { color: #a67f59 } /* Literal.String.Other */ +.highlight .sr { color: #a67f59 } /* Literal.String.Regex */ +.highlight .s1 { color: #a67f59 } /* Literal.String.Single */ +.highlight .ss { color: #a67f59 } /* Literal.String.Symbol */ +.highlight .vc { color: #0077aa } /* Name.Variable.Class */ +.highlight .vg { color: #0077aa } /* Name.Variable.Global */ +.highlight .vi { color: #0077aa } /* Name.Variable.Instance */ +.highlight .il { color: #000000 } /* Literal.Number.Integer.Long */ +

Service Workers Nightly

-

Editor’s Draft,

+

Editor’s Draft,

This version: @@ -1856,15 +1856,15 @@

Bootstrapping with a service worker:
// scope defaults to the path the script sits in
-// "/" in this example
-navigator.serviceWorker.register("/serviceworker.js").then(registration => {
-  console.log("success!");
+// "/" in this example
+navigator.serviceWorker.register("/serviceworker.js").then(registration => {
+  console.log("success!");
   if (registration.installing) {
-    registration.installing.postMessage("Howdy from your installing page.");
+    registration.installing.postMessage("Howdy from your installing page.");
   }
-}, err => {
-  console.error("Installing the worker failed!", err);
-});
+}, err => {
+  console.error("Installing the worker failed!", err);
+});
 

@@ -1896,7 +1896,7 @@

For example, consider a document created by a navigation to https://example.com/app.html which matches via the following registration call which has been previously executed:
// Script on the page https://example.com/app.html
-navigator.serviceWorker.register("/service_worker.js");
+navigator.serviceWorker.register("/service_worker.js");
 

The value of navigator.serviceWorker.controller.scriptURL will be "https://example.com/service_worker.js".

@@ -2395,37 +2395,37 @@

Serving Cached Resources:
// caching.js
-self.addEventListener("install", event => {
+self.addEventListener("install", event => {
   event.waitUntil(
     // Open a cache of resources.
-    caches.open("shell-v1").then(cache => {
+    caches.open("shell-v1").then(cache => {
       // Begins the process of fetching them.
       // The coast is only clear when all the resources are ready.
-      return cache.addAll([
+      return cache.addAll([
         "/app.html",
         "/assets/v1/base.css",
         "/assets/v1/app.js",
         "/assets/v1/logo.png",
         "/assets/v1/intro_video.webm"
-      ]);
-    })
-  );
-});
+      ]);
+    })
+  );
+});
 
-self.addEventListener("fetch", event => {
+self.addEventListener("fetch", event => {
   // No "fetch" events are dispatched to the service worker until it
   // successfully installs and activates.
 
   // All operations on caches are async, including matching URLs, so we use
   // promises heavily. e.respondWith() even takes promises to enable this:
   event.respondWith(
-    caches.match(e.request).then(response => {
-      return response || fetch(e.request);
-    }).catch(() => {
-      return caches.match("/fallback.html");
-    })
-  );
-});
+    caches.match(e.request).then(response => {
+      return response || fetch(e.request);
+    }).catch(() => {
+      return caches.match("/fallback.html");
+    })
+  );
+});
 
@@ -3642,7 +3642,7 @@
@@ -4753,12 +4773,14 @@

-

If job’s client is not null, queue a task to reject job’s job promise with reason on job’s client's responsible event loop using the DOM manipulation task source as the task source.

+

If job’s client is not null, queue a task, on job’s client's responsible event loop using the DOM manipulation task source, to reject job’s job promise with an exception that is a copy of reason, in job’s client's Realm.

  • For each equivalentJob in job’s list of equivalent jobs:

    1. -

      If equivalentJob’s client is not null, queue a task to reject equivalentJob’s job promise with reason on equivalentJob’s client's responsible event loop using the DOM manipulation task source as the task source.

      +

      If equivalentJob’s client is null, continue to the next iteration of the loop:

      +
    2. +

      Queue a task, on equivalentJob’s client's responsible event loop using the DOM manipulation task source, to reject equivalentJob’s job promise with an exception that is a copy of reason, in equivalentJob’s client's Realm.

  • @@ -4860,7 +4882,7 @@

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

    1. -

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

      +

      Invoke Resolve Job Promise with job and registration.

    2. Invoke Finish Job with job and abort these steps.

    @@ -4899,7 +4921,7 @@

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

  • -

    If job’s job type is update, and newestWorker’s script url does not equal job’s script url with the exclude fragments flag set, then:

    +

    If job’s job type is update, and newestWorker’s script url does not equal job’s script url with the exclude fragments flag set, then:

    1. Invoke Reject Job Promise with job and a TypeError.

      @@ -4915,10 +4937,10 @@

      "classic"
      -

      Fetch a classic worker script given job’s serialized script url, job’s client, "serviceworker", and the to-be-created environment settings object for this service worker.

      +

      Fetch a classic worker script given job’s serialized script url, job’s client, "serviceworker", and the to-be-created environment settings object for this service worker.

      "module"
      -

      Fetch a module worker script graph given job’s serialized script url, job’s client, "serviceworker", "omit", and the to-be-created environment settings object for this service worker.

      +

      Fetch a module worker script graph given job’s serialized script url, job’s client, "serviceworker", "omit", and the to-be-created environment settings object for this service worker.

      To perform the fetch given request, run the following steps:

        @@ -5016,7 +5038,7 @@

        If newestWorker is not null, newestWorker’s script url equals job’s script url with the exclude fragments flag set, and script’s source text is a byte-for-byte match with newestWorker’s script resource's source text, if script is a classic script, and script’s module record's [[ECMAScriptCode]] is a byte-for-byte match with newestWorker’s script resource's module record's [[ECMAScriptCode]] otherwise, then:

        1. -

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

          +

          Invoke Resolve Job Promise with job and registration.

        2. Invoke Finish Job with job and abort these steps.

        @@ -5105,9 +5127,9 @@

        Assert: job’s job promise is not null.

      1. -

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

        +

        Invoke Resolve Job Promise with job and registration.

      2. -

        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.

        +

        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.

      3. Let installingWorker be registration’s installing worker.

      4. @@ -5877,7 +5899,7 @@

        1. -

          If the origin of job’s scope url is not job’s client's origin, then:

          +

          If the origin of job’s scope url is not job’s client's origin, then:

          1. Invoke Reject Job Promise with job and a "SecurityError" exception.

            @@ -6018,7 +6040,7 @@

            1. -

              Let registrationObjects be an array containing all the ServiceWorkerRegistration objects associated with registration.

              +

              Let registrationObjects be an array containing all the ServiceWorkerRegistration objects associated with registration.

            2. If target is "installing", then:

                @@ -6574,37 +6596,37 @@

                Default scope:
                // Maximum allowed scope defaults to the path the script sits in
                -// "/js" in this example
                -navigator.serviceWorker.register("/js/sw.js").then(() => {
                -  console.log("Install succeeded with the default scope '/js'.");
                -});
                +// "/js" in this example
                +navigator.serviceWorker.register("/js/sw.js").then(() => {
                +  console.log("Install succeeded with the default scope '/js'.");
                +});
                 
                Upper path without Service-Worker-Allowed header:
                // Set the scope to an upper path of the script location
                -// Response has no Service-Worker-Allowed header
                -navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).catch(() => {
                -  console.error("Install failed due to the path restriction violation.");
                -});
                +// Response has no Service-Worker-Allowed header
                +navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).catch(() => {
                +  console.error("Install failed due to the path restriction violation.");
                +});
                 
                Upper path with Service-Worker-Allowed header:
                // Set the scope to an upper path of the script location
                -// Response included "Service-Worker-Allowed : /"
                -navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).then(() => {
                -  console.log("Install succeeded as the max allowed scope was overriden to '/'.");
                -});
                +// Response included "Service-Worker-Allowed : /"
                +navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).then(() => {
                +  console.log("Install succeeded as the max allowed scope was overriden to '/'.");
                +});
                 
                A path restriction voliation even with Service-Worker-Allowed header:
                // Set the scope to an upper path of the script location
                -// Response included "Service-Worker-Allowed : /foo"
                -navigator.serviceWorker.register("/foo/bar/sw.js", { scope: "/" }).catch(() => {
                -  console.error("Install failed as the scope is still out of the overriden maximum allowed scope.");
                -});
                +// Response included "Service-Worker-Allowed : /foo"
                +navigator.serviceWorker.register("/foo/bar/sw.js", { scope: "/" }).catch(() => {
                +  console.error("Install failed as the scope is still out of the overriden maximum allowed scope.");
                +});
                 
                @@ -7349,7 +7371,8 @@

                ports
              1. queue a microtask
              2. queue a task -
              3. realm +
              4. realm (for environment settings object) +
              5. realm (for global object)
              6. realm execution context
              7. referrer policy (for WorkerGlobalScope)
              8. referrer policy (for environment settings object) @@ -8449,10 +8472,9 @@

                4.1. ServiceWorkerGlobalScope
              9. 4.1.2. registration
              10. 8.1. Define API bound to Service Worker Registration -
              11. Register -
              12. Update -
              13. Install (2) -
              14. Update Registration State +
              15. Resolve Job Promise (2) +
              16. Install +
              17. Update Registration State
              @@ -4277,12 +4297,14 @@

              -

              If job’s client is not null, queue a task to reject job’s job promise with reason on job’s client's responsible event loop using the DOM manipulation task source as the task source.

              +

              If job’s client is not null, queue a task, on job’s client's responsible event loop using the DOM manipulation task source, to reject job’s job promise with an exception that is a copy of reason, in job’s client's Realm.

            3. For each equivalentJob in job’s list of equivalent jobs:

              1. -

                If equivalentJob’s client is not null, queue a task to reject equivalentJob’s job promise with reason on equivalentJob’s client's responsible event loop using the DOM manipulation task source as the task source.

                +

                If equivalentJob’s client is null, continue to the next iteration of the loop:

                +
              2. +

                Queue a task, on equivalentJob’s client's responsible event loop using the DOM manipulation task source, to reject equivalentJob’s job promise with an exception that is a copy of reason, in equivalentJob’s client's Realm.

            @@ -4306,7 +4328,7 @@

            Invoke Finish Job with job and abort these steps.

        2. -

          If the origin of job’s script url is not job’s client's origin, then:

          +

          If the origin of job’s script url is not job’s client's origin, then:

          1. Invoke Reject Job Promise with job and a "SecurityError" exception.

            @@ -4314,7 +4336,7 @@

            Invoke Finish Job with job and abort these steps.

        3. -

          If the origin of job’s scope url is not job’s client's origin, then:

          +

          If the origin of job’s scope url is not job’s client's origin, then:

          1. Invoke Reject Job Promise with job and a "SecurityError" exception.

            @@ -4334,7 +4356,7 @@

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

            1. -

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

              +

              Invoke Resolve Job Promise with job and registration.

            2. Invoke Finish Job with job and abort these steps.

            @@ -4373,7 +4395,7 @@

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

          2. -

            If job’s job type is update, and newestWorker’s script url does not equal job’s script url with the exclude fragments flag set, then:

            +

            If job’s job type is update, and newestWorker’s script url does not equal job’s script url with the exclude fragments flag set, then:

            1. Invoke Reject Job Promise with job and a TypeError.

              @@ -4389,10 +4411,10 @@

              "classic"
              -

              Fetch a classic worker script given job’s serialized script url, job’s client, "serviceworker", and the to-be-created environment settings object for this service worker.

              +

              Fetch a classic worker script given job’s serialized script url, job’s client, "serviceworker", and the to-be-created environment settings object for this service worker.

              "module"
              -

              Fetch a module worker script graph given job’s serialized script url, job’s client, "serviceworker", "omit", and the to-be-created environment settings object for this service worker.

              +

              Fetch a module worker script graph given job’s serialized script url, job’s client, "serviceworker", "omit", and the to-be-created environment settings object for this service worker.

              To perform the fetch given request, run the following steps:

                @@ -4490,7 +4512,7 @@

                If newestWorker is not null, newestWorker’s script url equals job’s script url with the exclude fragments flag set, and script’s source text is a byte-for-byte match with newestWorker’s script resource's source text, if script is a classic script, and script’s module record's [[ECMAScriptCode]] is a byte-for-byte match with newestWorker’s script resource's module record's [[ECMAScriptCode]] otherwise, then:

                1. -

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

                  +

                  Invoke Resolve Job Promise with job and registration.

                2. Invoke Finish Job with job and abort these steps.

                @@ -4579,9 +4601,9 @@

                Assert: job’s job promise is not null.

              1. -

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

                +

                Invoke Resolve Job Promise with job and registration.

              2. -

                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.

                +

                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.

              3. Let installingWorker be registration’s installing worker.

              4. @@ -5169,7 +5191,7 @@

                1. -

                  If the origin of job’s scope url is not job’s client's origin, then:

                  +

                  If the origin of job’s scope url is not job’s client's origin, then:

                  1. Invoke Reject Job Promise with job and a "SecurityError" exception.

                    @@ -5310,7 +5332,7 @@

                    1. -

                      Let registrationObjects be an array containing all the ServiceWorkerRegistration objects associated with registration.

                      +

                      Let registrationObjects be an array containing all the ServiceWorkerRegistration objects associated with registration.

                    2. If target is "installing", then:

                        @@ -5831,37 +5853,37 @@

                        Default scope:
                        // Maximum allowed scope defaults to the path the script sits in
                        -// "/js" in this example
                        -navigator.serviceWorker.register("/js/sw.js").then(() => {
                        -  console.log("Install succeeded with the default scope '/js'.");
                        -});
                        +// "/js" in this example
                        +navigator.serviceWorker.register("/js/sw.js").then(() => {
                        +  console.log("Install succeeded with the default scope '/js'.");
                        +});
                         
                        Upper path without Service-Worker-Allowed header:
                        // Set the scope to an upper path of the script location
                        -// Response has no Service-Worker-Allowed header
                        -navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).catch(() => {
                        -  console.error("Install failed due to the path restriction violation.");
                        -});
                        +// Response has no Service-Worker-Allowed header
                        +navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).catch(() => {
                        +  console.error("Install failed due to the path restriction violation.");
                        +});
                         
                        Upper path with Service-Worker-Allowed header:
                        // Set the scope to an upper path of the script location
                        -// Response included "Service-Worker-Allowed : /"
                        -navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).then(() => {
                        -  console.log("Install succeeded as the max allowed scope was overriden to '/'.");
                        -});
                        +// Response included "Service-Worker-Allowed : /"
                        +navigator.serviceWorker.register("/js/sw.js", { scope: "/" }).then(() => {
                        +  console.log("Install succeeded as the max allowed scope was overriden to '/'.");
                        +});
                         
                        A path restriction voliation even with Service-Worker-Allowed header:
                        // Set the scope to an upper path of the script location
                        -// Response included "Service-Worker-Allowed : /foo"
                        -navigator.serviceWorker.register("/foo/bar/sw.js", { scope: "/" }).catch(() => {
                        -  console.error("Install failed as the scope is still out of the overriden maximum allowed scope.");
                        -});
                        +// Response included "Service-Worker-Allowed : /foo"
                        +navigator.serviceWorker.register("/foo/bar/sw.js", { scope: "/" }).catch(() => {
                        +  console.error("Install failed as the scope is still out of the overriden maximum allowed scope.");
                        +});
                         
                        @@ -6509,7 +6531,8 @@

                        ports
                      1. queue a microtask
                      2. queue a task -
                      3. realm +
                      4. realm (for environment settings object) +
                      5. realm (for global object)
                      6. realm execution context
                      7. referrer policy (for WorkerGlobalScope)
                      8. referrer policy (for environment settings object) @@ -7484,10 +7507,9 @@

                        4.1. ServiceWorkerGlobalScope
                      9. 4.1.2. registration
                      10. 7.1. Define API bound to Service Worker Registration -
                      11. Register -
                      12. Update -
                      13. Install (2) -
                      14. Update Registration State +
                      15. Resolve Job Promise (2) +
                      16. Install +
                      17. Update Registration State