From 013a32cfd22d6d4bcb4a2099c2d4fd641a26a90b Mon Sep 17 00:00:00 2001 From: Joe Liccini Date: Fri, 19 Jul 2019 09:29:44 -0700 Subject: [PATCH] Add a note about termination during activation. Activation handlers may not all get a chance to run, especially in the case of browser termination. A Service Worker should be designed to function properly, even if the activation handlers do not all complete successfully. Update Nightly and V1 --- docs/index.bs | 2 ++ docs/v1/index.bs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/index.bs b/docs/index.bs index 9ddc8b7b..ad46059f 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -2734,6 +2734,8 @@ 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. + Note: Make sure to design activation handlers to do non-essential work (like cleanup). This is because activation handlers may not all run to completion, especially in the case of browser termination during activation. A Service Worker should be designed to function properly, even if the activation handlers do not all complete successfully. + 1. Let |matchedClients| be a [=list=] of [=/service worker clients=] whose creation URL matches |registration|'s [=service worker registration/scope url=]. 1. [=list/For each=] |client| of |matchedClients|, [=queue a task=] on |client|'s [=responsible event loop=], using the [=DOM manipulation task source=], to run the following substeps: 1. Let |readyPromise| be |client|'s [=environment settings object/global object=]'s {{ServiceWorkerContainer}} object's [=ServiceWorkerContainer/ready promise=]. diff --git a/docs/v1/index.bs b/docs/v1/index.bs index 1c019e9d..6ac0addb 100644 --- a/docs/v1/index.bs +++ b/docs/v1/index.bs @@ -2546,6 +2546,8 @@ 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. + Note: Make sure to design activation handlers to do non-essential work (like cleanup). This is because activation handlers may not all run to completion, especially in the case of browser termination during activation. A Service Worker should be designed to function properly, even if the activation handlers do not all complete successfully. + 1. Let |matchedClients| be a [=list=] of [=/service worker clients=] whose creation URL matches |registration|'s [=service worker registration/scope url=]. 1. [=list/For each=] |client| of |matchedClients|, [=queue a task=] on |client|'s [=responsible event loop=], using the [=DOM manipulation task source=], to run the following substeps: 1. Let |readyPromise| be |client|'s [=environment settings object/global object=]'s {{ServiceWorkerContainer}} object's [=ServiceWorkerContainer/ready promise=].