ladybird/Tests/LibWeb/Text/input/abortsignal-timeout.html
Tim Ledbetter 130f28cf50 LibWeb: Mark abort event as trusted before dispatching it
This matches the behavior of Firefox and Chrome.
2024-03-12 09:31:41 +01:00

16 lines
738 B
HTML

<script src="include.js"></script>
<script>
asyncTest(done => {
const timeout_milliseconds = 10;
const test_start_time = performance.now();
const signal = AbortSignal.timeout(timeout_milliseconds);
signal.onabort = (event) => {
const abort_event_time = performance.now();
const time_taken_milliseconds = abort_event_time - test_start_time;
println(`Time passed before abort event fired is at least ${timeout_milliseconds} milliseconds: ${time_taken_milliseconds >= timeout_milliseconds}`);
println(`Reason type: ${signal.reason.name}`);
println(`onabort event isTrusted: ${event.isTrusted}`);
done();
};
});
</script>