LibWeb: Fire error event when script has an execution error

We now use the "report an exception" AO when a script has an execution
error. This has mostly replaced the older "report the exception" AO in
various specifications. Using this newer AO ensures that
`window.onerror` is invoked when a script has an execution error.
This commit is contained in:
Tim Ledbetter
2024-09-26 15:40:23 +01:00
committed by Tim Flynn
parent 994457d7af
commit 579a289d3d
6 changed files with 35 additions and 4 deletions

View File

@@ -0,0 +1 @@
onerror event fired: Error: Uncaught error

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<script>
asyncTest(done => {
window.addEventListener("error", (event) => {
println(`onerror event fired: ${event.error}`);
done();
});
try {
throw new Error("FAIL");
} catch (e) {}
throw new Error("Uncaught error");
});
</script>