-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fire an ErrorEvent instead an Event #2289
Comments
What are the different cases where |
There are some WPT tests where we use ErrorEvent when, in theory, we should have Error. For instance: . workers/constructors/Worker/same-origin.html Are they wrong? Or am I missing something? |
Hmm. They look wrong per spec. But if more browsers fire |
Pretty much, yes. Gecko code has a codepath here for "URL parse failure", but I'm not sure that's really reachable. So maybe there's nothing useful that can be communicated here... |
The tests also allow either an exception or an error event, which seems bogus. |
The spec's first step for
but it's unclear to me it is a good idea to have these tests pass if a |
|
Mmm. Yes, looks like the Firefox code there is not following the spec either, in that things like same-origin and "no mixed content" and "is this page even allowed to run workers" are all checked synchronously before the constructor returns, and lead to exceptions on failure. |
As for the async
However, if the error is propagated from the WorkerGlobalScope (exceptions are not handled in WorkerGlobalScope.onerror), The current browser behavior is:
|
Hi, @domenic Specifically, in run a worker
Because from WPT, some test testing with Event failed, whereas some test testing with ErrorEvent is passed among all browsers. /workers/dedicated-worker-parse-error-failure.html, which is testing Event, is failed among all browsers There is another test, I've checked the commit history of AbstractWorker.onerror.html http://web.archive.org/web/20150604031622/https://html.spec.whatwg.org/multipage/workers.html#run-a-worker http://web.archive.org/web/20150604100312/https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error So the test AbstractWorker.onerror.html looks like it was testing with the older spec, but not the current spec ? And the commit to check if the script has an error to rethrow, is from Although the fix was originally to fix SharedWorker, but I assume it also fixed DedicatedWorker? Thanks |
I cannot confirm the spec is correct. As attested by the fact that this issue is still open, there is a long history of discussion about what the correct type of event is to fire here. |
After reviewing the exact location at which you inserted the note in #9595, I think the current spec is correct. There's no way an |
https://html.spec.whatwg.org/multipage/workers.html#worker-processing-model-top
Why are we firing a normal event and not an ErrorEvent?
With an ErrorEvent we can specify a message and this can be useful.
The text was updated successfully, but these errors were encountered: