-
Notifications
You must be signed in to change notification settings - Fork 3.1k
new SharedWorker() should queue a task to fire an error when parse error occurs #5323
Description
According to the current spec, a shared worker doesn't fire an error event when parse error occurs while it does for fetch failure which fails in the same step as parse error. It would be nice to fire an error event for parse error as well so that developers can catch the error by AbstractWorker.onerror with the description of failure.
Fetch failure is caught here:
Step 12: Obtain script by switching on the value of options's type member: ...
If the algorithm asynchronously completes with null, then:
SubStep1: Queue a task to fire an event named error at worker.
We get null as a result of fetching algorithm when fetch failure occurs but we get the result with |error to rethrow| when parse error occurs and it is treated as non-null. Therefore, I suggest to modify the spec by adding the condition to the error handling step like:
"If the algorithm asynchronously completes with null or script whose error to rethrow is not null, then: queue a task to fire an event named error at worker ..."
(As far as I know, FireFox has already implemented parse error handling as this.)
The similar change has done in worklets spec as well: w3c/css-houdini-drafts#509
The corresponding spec is here: https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
For more information if you need: https://docs.google.com/document/d/1ot2GurRwSUlvAEB1_XlVPR9-7KT8lAmK1sAb8P11qZY/edit#heading=h.fo73cyj0hll