Files
serenity/Tests/LibWeb/Text/input/HTML/Window-onerror.html
Andrew Kaster 1dfd8755bc 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.

(cherry picked from commit 8edaec79dea2f39a31ee97738dfa2e74911efe26)
2024-11-17 13:47:42 -05:00

20 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>