mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-20 02:40:27 +00:00
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.
20 lines
808 B
HTML
20 lines
808 B
HTML
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
removeTestErrorHandler()
|
|
|
|
window.onerror = (message, filename, lineno, colno, error) => {
|
|
println(`message = ${message}`);
|
|
println(`lineno = ${lineno}`);
|
|
println(`colno = ${colno}`);
|
|
println(`error = ${error}`);
|
|
// We can't simply print the filename because it is the full path to the active script, which varies between machines.
|
|
const filenameURL = new URL(filename);
|
|
println(`filename URL scheme = ${filenameURL.protocol}`);
|
|
println(`filename URL final path segment = ${filenameURL.pathname.split('/').pop()}`);
|
|
return true;
|
|
};
|
|
|
|
window.reportError(new Error('Reporting an Error!'));
|
|
});
|
|
</script>
|