New issue
Advanced search Search tips

Issue 709591 link

Starred by 3 users

Issue metadata

Status: Duplicate
Merged: issue 719850
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



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.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/406fa418432ec6bcb3b40f2fa95b30da5175e581

commit 406fa418432ec6bcb3b40f2fa95b30da5175e581
Author: mike <mike@mikepennisi.com>
Date: Fri Apr 07 21:11:27 2017

Upstream service worker ext. event tests to WPT

The Web Platform Tests project includes equivalent versions of these
tests.

- `extendable-event-async-waituntil.html` - the version in WPT has been
  extended with additional assertions, rendering the Chromium version
  obsolete.
- `extendable-event-waituntil.html` - the version in WPT has been
  extended to support (but not require) more rigorous compliance with
  the specification. Update that test to be more precise and document
  the expected failure in the Chromium infrastructure.

BUG= 688116 ,  709591 
R=falken@chromium.org

Review-Url: https://codereview.chromium.org/2789003002
Cr-Commit-Position: refs/heads/master@{#463003}

[add] https://crrev.com/406fa418432ec6bcb3b40f2fa95b30da5175e581/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/extendable-event-waituntil.https-expected.txt
[modify] https://crrev.com/406fa418432ec6bcb3b40f2fa95b30da5175e581/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/extendable-event-waituntil.https.html
[modify] https://crrev.com/406fa418432ec6bcb3b40f2fa95b30da5175e581/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/extendable-event-waituntil.js
[delete] https://crrev.com/f0967b500becdadb10fa3b91bea592105fb74730/third_party/WebKit/LayoutTests/http/tests/serviceworker/extendable-event-async-waituntil.html
[delete] https://crrev.com/f0967b500becdadb10fa3b91bea592105fb74730/third_party/WebKit/LayoutTests/http/tests/serviceworker/extendable-event-waituntil.html
[delete] https://crrev.com/f0967b500becdadb10fa3b91bea592105fb74730/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/extendable-event-waituntil.js

Comment 2 by horo@chromium.org, Apr 13 2017

Owner: falken@chromium.org
Status: Assigned (was: Unconfirmed)
falken@
Can you handle this?

Comment 3 by horo@chromium.org, Apr 13 2017

Labels: -Pri-2 Pri-3
I think the priority is not high.
Cc: falken@chromium.org
Mergedinto: 719850
Owner: leon....@intel.com
Status: Duplicate (was: Assigned)
Fixed by Leon in  issue 719850 .

Sign in to add a comment