Error event inside a worker does not provide the actual exception value
Reported by
bzbar...@mit.edu,
Aug 24 2016
|
||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:51.0) Gecko/20100101 Firefox/51.0 Example URL: Steps to reproduce the problem: 1. Load attached testcase. 2. Look at the developer console output. What is the expected behavior? The string that gets logged should be "Error". What went wrong? The string that gets logged is "null". Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? No Firefox. Chrome version: 54.0.2837.0 (Official Build) dev (64-bit) Channel: n/a OS Version: OS X 10.10 Flash Version: WebKit nightly gets this right. See https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2 which should go to https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error which in step 12 should propagate through the exception value. The Firefox issue is tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=986459
,
Aug 29 2016
nhiorki@ Can you handle this issue?
,
Oct 11 2016
Is this related to Issue 590219?
,
Oct 11 2016
Doesn't seem likely: that issue is about the error event seen _outside_ the worker, while this one is for the error event _inside_ the worker.
,
Mar 30 2017
Issue 706037 has been merged into this issue.
,
Mar 30 2017
This is biting people using service workers also. I'd be interested in seeing if there are WPT tests for this.
,
Mar 30 2017
,
Apr 2 2017
Mozilla added a WPT for this in the linked bug: https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/external/wpt/workers/Worker_ErrorEvent_error.htm Considering Mozilla vetted the spec and added this test, looks like we just need to get this test passing.
,
Apr 3 2017
I'm now investigating...
,
Apr 3 2017
bashi@ helped me to investigate this (thank you!) and we found there're two issues here:
1) In WorkerOrWorkletScriptController.cpp, 'ErrorEvent' is created without 'error' attribute[1]. This results in 'e.error == null' in following code:
// worker.js
addEventListener("error", function(e) {
// e.error == null here because the event is created w/o 'error' attribute.
});
throw "hello";
2) Currently, Blink's WorkerGlobalScope.idl does not support "OnErrorEventHandler" interface (see foolip@'s comment on [2]). This results in 'e.error == null' in following code:
// worker.js
onerror = function(message, location, line, col, error) {
// error == null here because the idl does not support this callback signature.
}
throw "hello";
I think fixing only the case 1) would be enough for real applications, we need to fix the both cases to pass the web-platform-test (Worker_ErrorEvent_error.htm) though.
[1] https://chromium.googlesource.com/chromium/src/+/f98f8cb0517d4b28943102a007528063252e0ce0/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp#326
[2] https://chromium.googlesource.com/chromium/src/+/f98f8cb0517d4b28943102a007528063252e0ce0/third_party/WebKit/Source/core/workers/WorkerGlobalScope.idl#38
,
Apr 3 2017
Agree that fixing 1) is a good first thing to do.
,
Apr 3 2017
yiyix@, do you think you could take a look at 1) on c#10? Probably, we could... 1) add a new ctor which takes a ScriptValue and assigns it to |m_error|. 2) pass |state.exception| to the ctor in [1]. 3) add a new layout test for this change (because the wpt test does not work yet at this point)
,
Apr 3 2017
^^^ 1) add a new ctor *to ErrorEvent* which takes...
,
Apr 6 2017
Filed a separate issue for 2) "OnErrorEventHandler" ( issue 708857 )
,
Apr 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0662e1de8c6d9800c4baed479249c1fa5201c24c commit 0662e1de8c6d9800c4baed479249c1fa5201c24c Author: yiyix <yiyix@chromium.org> Date: Thu Apr 06 14:16:37 2017 Update Error Event inside a worker to provide the exact exception value In WorkerOrWorkletScriptController.cpp, 'ErrorEvent' used to be created without exception value, so the exception, |m_error|, is always set to null. A new constructor of ErrorEvent is added in this patch which takes exception as input and set |m_error| to the exception value. TEST=error-script.js and error-worker-script.js BUG= 640724 Review-Url: https://codereview.chromium.org/2804533002 Cr-Commit-Position: refs/heads/master@{#462458} [add] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/ServiceWorkerGlobalScope/resources/error-worker.js [add] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/ServiceWorkerGlobalScope/service-worker-error-event.https.html [add] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/LayoutTests/fast/workers/dedicated-worker-error-event.html [add] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/LayoutTests/fast/workers/resources/error-script.js [modify] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/Source/bindings/core/v8/WorkerOrWorkletScriptController.cpp [modify] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/Source/core/events/ErrorEvent.cpp [modify] https://crrev.com/0662e1de8c6d9800c4baed479249c1fa5201c24c/third_party/WebKit/Source/core/events/ErrorEvent.h
,
Apr 7 2017
Thanks for the fix! |
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by dglazkov@chromium.org
, Aug 25 2016Status: Untriaged (was: Unconfirmed)