You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.addEventListener("error", e => {...});
importScripts('https://cross-origin.example.com/syntax-error.js');
According to the spec IIUC, "NetworkError" DOMException is reported to the WorkerGlobalScrope's error event, while <script src="https://cross-origin.example.com/syntax-error.js"></script> would report "Script error.".
evaluationStatus is set to the parse error of syntax-error.js, and
a "NetworkError" DOMException is thrown in Step 8.2.2 of the inner #run-a-classic-script.
After returning from inner #run-a-classic-script, #report-the-exception is executed in Step 8.3.1 of the outer #run-a-classic-script for worker.js.
The "NetworkError" DOMException is passed as e.error in the WorkerGlobalScope's error handler.
This is not sanitized to "Script error." because the script here is worker.js with muted errors flag unset.
Is this expected behavior?
Anyway the details of errors are not exposed so I don't think this is a major issue; I just want to double check, because I'm considering chaning Chromium's behavior from "Script error." to NetworkError DOMException, and this might be affected by #958.
The logic is that the ... code needs to be given a real JavaScript Error object. So we synthesize a new "NetworkError" DOMException for that purpose.
But, if you didn't catch that "NetworkError" DOMException, then it will reach the global scope, and the self.addEventListener("error", e => { ... }) handler.
So it's best to think of these errors as coming from the "same-origin" importScripts function, not from the cross-origin https://cross-origin.example.com/syntax-error.js script.
Thanks for working on web platform tests for this! Regarding the not-very-well-specified filename/lineno/colno fields, I think Firefox's results are more in line with the above philosophy, and I'd support adding tests for those. (Maybe even try making colno nonzero with something like false,importScripts(...).)
For
with worker.js:
According to the spec IIUC,
"NetworkError" DOMException
is reported to the WorkerGlobalScrope's error event, while<script src="https://cross-origin.example.com/syntax-error.js"></script>
would report"Script error."
.worker.js
.ScriptEvaluation()
forworker.js
),importScripts()
is executed, and thus inner https://html.spec.whatwg.org/C/#run-a-classic-script is executed for thesyntax-error.js
with muted errors = true.evaluationStatus
is set to the parse error ofsyntax-error.js
, and"NetworkError" DOMException
is thrown in Step 8.2.2 of the inner #run-a-classic-script.worker.js
."NetworkError" DOMException
is passed ase.error
in the WorkerGlobalScope's error handler."Script error."
because the script here isworker.js
with muted errors flag unset.Is this expected behavior?
Anyway the details of errors are not exposed so I don't think this is a major issue; I just want to double check, because I'm considering chaning Chromium's behavior from
"Script error."
to NetworkError DOMException, and this might be affected by #958.Implementation behavior:
e.error
"Script error."
"Error: Script error."
e.filename
""
worker.js
worker.js
e.lineno
worker.js
worker.js
e.colno
worker.js
Investigation WPT: web-platform-tests/wpt#24810
The text was updated successfully, but these errors were encountered: