New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 894358 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

The error attribute of ErrorEvent should be initialized to null for dedicated workers

Project Member Reported by yukiy@google.com, Oct 11

Issue description

When an uncaught runtime script error occurs in one of the worker's scripts, the error attribute of ErrorEvent should be initialized to null for dedicated workers.
Current implementation does not do that, but instead, the error argument for OnErrorEventHandler is set to null in JSEventHandler::CallListenerFunction().

Standard definition: https://html.spec.whatwg.org/C/workers.html#runtime-script-errors-2
 
WPT: LayoutTests/external/wpt/workers/Worker_ErrorEvent_error.htm
To be more precise, ErrorEvent on WorkerGlobalScope should have a valid 'error' attribute[1], while ErrorEvent propagated to parent Document should have a null 'error' attribute[2].

[1] https://html.spec.whatwg.org/multipage/webappapis.html#runtime-script-errors
"7. ... and the error attribute initialized to errorValue."

[2] https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2
"1. ... and the error attribute initialized to null."
Looks like the test expectation for the WPT was removed by this CL (Oct. 19)
https://chromium-review.googlesource.com/c/chromium/src/+/1289078

, I'm not sure when this was fixed though. At least my local Chrome (70.0.3538.77) fails the test.
Ok, the test was fixed by yukiy@:
https://chromium-review.googlesource.com/c/chromium/src/+/1215512/65/third_party/blink/renderer/bindings/core/v8/js_event_handler.cc#70

This CL added special handling for dedicated workers in JSEventHandler::CallListenerFunction() as mentioned in the reporter's comment.
Wait. According to c#4, I ran the test on ToT developer build without the special handling, and confirmed that passed... hmmm. There might be another factor to enable the test to pass. Maybe I should stop archaeology now :p
By the way, the spec requires ErrorEvent.error defaults to 'null'[1] but the current impl doesn't do it[2]. Probably, we should initialize 'error' attribute as 'null' not only for dedicated workers but also for other execution contexts.

[1] https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface
[2] https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/core/events/error_event.cc#103

Sign in to add a comment