whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.09k stars 2.66k forks source link

Report runtime error in shared workers #5363

Open elkurin opened 4 years ago

elkurin commented 4 years ago

Shared workers now handle fetch/parse error but not runtime(evaluation) error. This is because we catch fetch/parse error here:

Step 12: If the algorithm asynchronously completes with null or with a script whose error to rethrow is non-null, then: Queue a task to fire an event named error at worker. https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model

On the other hand, unhandled runtime error is not caught.

For shared workers, if the error is still not handled afterwards, the error may be reported to a developer console. https://html.spec.whatwg.org/#runtime-script-errors-2

This behavior is different from that of dedicated workers which fire an even name error at the associated workers if the event is not handled yet.

It might be better to fire an event for runtime error similarly to dedicated workers. However, this might report to the shared worker instances which are not related to the evaluation error itself because one shared worker might be connected with several different instances and runtime error is invoked from only one of them.

This is also discussed in #5323.

hiroshige-g commented 1 year ago

User-reported Chromium issue filed: https://bugs.chromium.org/p/chromium/issues/detail?id=1385619

hiroshige-g commented 1 year ago

WPT Test: https://wpt.fyi/results/workers/SharedWorker-script-error.html?label=experimental&label=master&aligned

So Chrome/Safari follow the current spec while Firefox is (probably) aligned with the proposed behavior here.

smaug---- commented 1 year ago

@ asutherland