Re: [w3c/ServiceWorker] Improve.ready and Activate (#1277)

jakearchibald requested changes on this pull request.



> -        1. Let |client| be the <a>context object</a>'s [=ServiceWorkerContainer/service worker client=].
-        1. Let |clientURL| be |client|'s <a>creation URL</a>.
-        1. Run the following substeps <a>in parallel</a>:
-            1. *CheckRegistration*: Let |registration| be the result of running <a>Match Service Worker Registration</a> algorithm with |clientURL|.
-            1. If |registration| is null, then:
-                1. Wait until <a>scope to registration map</a> has a new entry.
-                1. Jump to the step labeled *CheckRegistration*.
-            1. If |registration|'s <a>active worker</a> is null, wait until |registration|'s <a>active worker</a> changes.
-
-                Note: Implementers should consider this condition is met when the corresponding registration request gets to the step 6 of <a>Activate</a> algorithm.
-
-            1. Resolve <a>context object</a>'s [=ServiceWorkerContainer/ready promise=] with the {{ServiceWorkerRegistration}} object which represents |registration|.
-        1. Return <a>context object</a>'s [=ServiceWorkerContainer/ready promise=].
+        1. Let |readyPromise| be the [=context object=]'s [=ServiceWorkerContainer/ready promise=].
+        1. If |readyPromise| is pending, then:
+            1. Let |registration| be the result of running [=Match Service Worker Registration=] with the [=context object=]'s [=ServiceWorkerContainer/service worker client=]'s [=creation URL=].

I don't think we should be running this on the main thread since it's a disk read.

> @@ -2541,7 +2532,11 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
 
           Note: Once an active worker is activating, neither a runtime script error nor a force termination of the active worker prevents the active worker from getting activated.
 
-      1. For each [=/service worker client=] |client| whose <a>creation URL</a> <a lt="Match Service Worker Registration">matches</a> |registration|'s [=service worker registration/scope url=]:
+      1. Let |matchedClients| be a [=list=] of [=/service worker clients=] whose <a>creation URL</a> <a lt="Match Service Worker Registration">matches</a> |registration|'s [=service worker registration/scope url=].
+      1. [=list/For each=] |client| of |matchedClients|:
+          1. Let |readyPromise| be |client|'s [=environment settings object/global object=]'s {{ServiceWorkerContainer}} object's [=ServiceWorkerContainer/ready promise=].

I think we need to queue a task on each client to do this.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1277#pullrequestreview-95446607

Received on Friday, 9 February 2018 15:02:01 UTC