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

In the following snippet for example:
```js
addEventListener('push', e => {
  let outResolve;
  let p = new Promise(resolve => { outResolve = resolve; });
  e.waitUntil(p); // Upon fulfillment/rejection of p inside
  p.then(() => {
    e.waitUntil(q);
  });
  setTimeout(() => outResolve(), 1);
});
```
I think the "Upon fulfillment/rejection of p" triggered inside of `waitUntil()` queues (precisely, it appends the reaction to p.[[PromiseFulfillReactions]] as p is pending) the dcrease job before the promise job for `e.waitUntil(q);` is queued, which makes `e.waitUntil(q);` throws.

-- 
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#issuecomment-271760589

Received on Wednesday, 11 January 2017 02:29:12 UTC