Issue metadata
Sign in to add a comment
|
Lifecycle events incorrectly continue following rejection of any "extend lifetime" promise
Reported by
m...@mikepennisi.com,
Apr 7 2017
|
||||||||||||||||||||||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36
Steps to reproduce the problem:
1. Create a file with the following source:
self.addEventListener('install', function(e) {
e.waitUntil(new Promise(function() {}));
e.waitUntil(Promise.reject(new Error()));
});
2. Register a service worker with the above file
What is the expected behavior?
The worker should hold in the 'installing' state indefinitely.
What went wrong?
The worker transitioned to the 'redundant' state and was disposed.
Did this work before? No
Does this work in other browsers? Yes
Chrome version: 56.0.2924.76 Channel: n/a
OS Version: Ubuntu 16.04 LTS
Flash Version:
In the latest version of the Service Workers specification, the Install
algorithm [1] states that waiting should continue until all Promises are
settled. The "wait" condition makes no distinction between fulfillment and
rejection. A rejection in any of the promises effects the subsequent behavior,
but unlike `Promise.all`, it does not cause the overall "wait" operation to
end. The same is true of the Activate algorithm (although in that case,
rejection does not effect subsequent behavior) [2].
Chromium stops the "wait" operation as soon as any one Promise is rejected. In
this way, it seems to be following `Promise.all` semantics when interpreting
the worker's "extend lifetime" promises.
[1] https://w3c.github.io/ServiceWorker/#installation-algorithm
> [...]
> 10. Queue a task task to run the following substeps:
> [...]
> 4. WaitForAsynchronousExtensions: Run the following substeps in parallel:
> 1. Wait until e’s pending promises count is zero.
> 2. If the result of waiting for all of e’s extend lifetime promises
> rejected, set installFailed to true.
[2] https://w3c.github.io/ServiceWorker/#activation-algorithm
> 10. Queue a task task to run the following substeps:
> 1. Let e be the result of creating an event with ExtendableEvent.
> 2. Initialize e’s type attribute to activate.
> 3. Dispatch e at activeWorker’s global object.
> 4. WaitForAsynchronousExtensions: Wait, in parallel, until e’s pending
> promises count is zero.
,
Apr 13 2017
falken@ Can you handle this?
,
Apr 13 2017
I think the priority is not high.
,
Aug 3 2017
Fixed by Leon in issue 719850 . |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by bugdroid1@chromium.org
, Apr 7 2017