New issue
Advanced search Search tips

Issue 685531 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 678905



Sign in to add a comment

WPT test oninstall-script-error.html should pass

Project Member Reported by falken@chromium.org, Jan 26 2017

Issue description

The WPT test got changed based on the discussion in https://github.com/w3c/ServiceWorker/issues/896.

According to the spec and the WPT test, an exception occurring during oninstall should not cause installation to fail. But Chrome fails the installation.

So we have to:
1) Change Chrome to not fail the installation when the install handler throws an error.
2) Verify external/wpt/service-workers/service-worker/oninstall-script-error.html passes. 
3) Edit our corresponding http/tests/serviceworker/oninstall-script-error.html to match the test.


 

Comment 1 by yiyix@chromium.org, Feb 22 2017

Cc: yiyix@chromium.org
Owner: ----
Cc: -yiyix@chromium.org peter@chromium.org
Components: Blink>PushAPI Blink>BackgroundSync
Owner: yiyix@chromium.org
+peter as this will affect notification/push/sync/etc. Can you confirm this change is likely OK?

To fix this bug, we will remove the code that detects an uncaught exception during the dispatch of the extendable event and transforms it into an error equivalent to rejection of the waitUntil promise (see ServiceWorkerGlobalScope::dispatchEventInternal).

I originally added this code in oninstall believing it's what the spec expected ( bug 553558 ), but consensus has settled on the opposite behavior.

Changing will affect all extendable events. A quick patch showed that no tests fail except for the install event WPT test (as expected), so there is evidently no test coverage here. I think an Intent to Ship is too heavyweight for this change, but we should review that it's probably OK.

The potentially affected events are:
- activate: this change will have no effect, as it already ignores rejected waitUntil
- install: this change will match the current WPT test as desired.
- notification push/click/close: I believe these currently turn into PERSISTENT_NOTIFICATION_STATUS_EVENT_WAITUNTIL_REJECTED which looks only used for UMA?
- sync: looks like this is treated as an error and is possibly retried.  https://cs.chromium.org/chromium/src/content/browser/background_sync/background_sync_manager.cc?type=cs&l=1079
- payment request: error code seems only used for UMA

Concretely, in the current impl Blink uses WebServiceWorkerEventResultRejected to signal that the exception occurred, and Chrome typically this into SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED.
> I originally added this code in oninstall believing it's what the spec expected ( bug 553558 )

For archaeological purposes, actually I implemented this in  bug 425960  and refined in  bug 553558 .
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 21 2017

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

commit a626eb843a373043835437074f4c7de51baf00f4
Author: yiyix <yiyix@chromium.org>
Date: Tue Mar 21 07:24:08 2017

Fix oninstall-script tests for service worker

According to the spec and the WPT test, an exception occurring during oninstall
should not cause installation to fail. This change makes the test pass.

Note that this checks removal may affect the behavior of all ExtendableEvents;
however it is expected to be fine as explained in the bug.

BUG= 685531 

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

[delete] https://crrev.com/aaf64ecd8fdbdf8e35f6c7bfe5706df02b777a62/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/oninstall-script-error.https-expected.txt
[delete] https://crrev.com/aaf64ecd8fdbdf8e35f6c7bfe5706df02b777a62/third_party/WebKit/LayoutTests/http/tests/serviceworker/oninstall-script-error.html
[modify] https://crrev.com/a626eb843a373043835437074f4c7de51baf00f4/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
[modify] https://crrev.com/a626eb843a373043835437074f4c7de51baf00f4/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h

Comment 5 by yiyix@chromium.org, Mar 24 2017

Status: Fixed (was: Assigned)

Comment 6 by falken@chromium.org, Mar 27 2017

Labels: M-59

Sign in to add a comment