Re: [w3c/ServiceWorker] Improve handling of extend lifetime promises (#1049)

annevk requested changes on this pull request.



>        : Output
       :: None
 
-      1. If |event|'s <a>extend lifetime promises</a> is empty, unset |event|'s <a>extensions allowed flag</a> and abort these steps.
-      1. Let |extendLifetimePromises| be an empty array.
-      1. Run the following substeps <a>in parallel</a>:
-          1. *SetupPromiseArray*: Set |extendLifetimePromises| to a copy of |event|'s <a>extend lifetime promises</a>.
-          1. Wait until all the <a>promises</a> in |extendLifetimePromises| settle.
-          1. If the length of |extendLifetimePromises| does not equal the length of |event|'s <a>extend lifetime promises</a>, jump to the step labeled *SetupPromiseArray*.
-          1. Unset |event|'s <a>extensions allowed flag</a>.
-
-      The user agent *should not* <a lt="terminate service worker">terminate</a> the [=/service worker=] associated with |event|'s <a>relevant settings object</a>'s [=environment settings object/global object=] until |event|'s <a>extensions allowed flag</a> is unset. However, the user agent *may* impose a time limit to this lifetime extension.
+      1. Wait, [=in parallel=], until |promise| is settled and |promise|'s <code>then</code> methods, if any, in the task where |promise| has been settled have executed.

How would you test the "and" requirement here? That should be removed I think.

>        : Output
       :: None
 
-      1. If |event|'s <a>extend lifetime promises</a> is empty, unset |event|'s <a>extensions allowed flag</a> and abort these steps.
-      1. Let |extendLifetimePromises| be an empty array.
-      1. Run the following substeps <a>in parallel</a>:
-          1. *SetupPromiseArray*: Set |extendLifetimePromises| to a copy of |event|'s <a>extend lifetime promises</a>.
-          1. Wait until all the <a>promises</a> in |extendLifetimePromises| settle.
-          1. If the length of |extendLifetimePromises| does not equal the length of |event|'s <a>extend lifetime promises</a>, jump to the step labeled *SetupPromiseArray*.
-          1. Unset |event|'s <a>extensions allowed flag</a>.
-
-      The user agent *should not* <a lt="terminate service worker">terminate</a> the [=/service worker=] associated with |event|'s <a>relevant settings object</a>'s [=environment settings object/global object=] until |event|'s <a>extensions allowed flag</a> is unset. However, the user agent *may* impose a time limit to this lifetime extension.
+      1. Wait, [=in parallel=], until |promise| is settled and |promise|'s <code>then</code> methods, if any, in the task where |promise| has been settled have executed.
+      2. [=Queue a microtask=], on |promise|'s [=relevant settings object=]'s [=responsible event loop=], to decrease |event|'s [=ExtendableEvent/pending promises count=] by one.

As I said earlier, you cannot queue microtasks from parallel algorithms.

-- 
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/1049#pullrequestreview-15670873

Received on Monday, 9 January 2017 10:07:35 UTC