ladybird/Tests/LibWeb/Text/input/HTML/Window-onerror.html
Andrew Kaster 8edaec79de LibWeb: Add a feature to LibWeb tests to fail on unhandled exceptions
Previously, if there was an unhandled exception in an async test, it
might fail to call done() and timeout. Now we have a default "error"
handler to catch unhandled exceptions and fail the test. A few tests
want to actually test the behavior of window.onerror, so they need an
escape hatch.
2024-10-05 09:18:32 +02:00

19 lines
405 B
HTML

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