ladybird/Tests/LibWeb/Text/input/HTML/WindowOrWorkerGlobalScope-reportError.html
Tim Ledbetter 34b9873664 LibWeb: Populate filename in WindowOrWorkerGlobalScope.reportError()
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.
2024-07-08 11:26:24 +02:00

18 lines
774 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
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>