mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:27:45 +00:00
LibWeb: Mark abort event as trusted before dispatching it
This matches the behavior of Firefox and Chrome.
This commit is contained in:
parent
3bec616893
commit
130f28cf50
3 changed files with 6 additions and 2 deletions
|
@ -1,2 +1,3 @@
|
||||||
Time passed before abort event fired is at least 10 milliseconds: true
|
Time passed before abort event fired is at least 10 milliseconds: true
|
||||||
Reason type: TimeoutError
|
Reason type: TimeoutError
|
||||||
|
onabort event isTrusted: true
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
const timeout_milliseconds = 10;
|
const timeout_milliseconds = 10;
|
||||||
const test_start_time = performance.now();
|
const test_start_time = performance.now();
|
||||||
const signal = AbortSignal.timeout(timeout_milliseconds);
|
const signal = AbortSignal.timeout(timeout_milliseconds);
|
||||||
signal.onabort = () => {
|
signal.onabort = (event) => {
|
||||||
const abort_event_time = performance.now();
|
const abort_event_time = performance.now();
|
||||||
const time_taken_milliseconds = abort_event_time - test_start_time;
|
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(`Time passed before abort event fired is at least ${timeout_milliseconds} milliseconds: ${time_taken_milliseconds >= timeout_milliseconds}`);
|
||||||
println(`Reason type: ${signal.reason.name}`);
|
println(`Reason type: ${signal.reason.name}`);
|
||||||
|
println(`onabort event isTrusted: ${event.isTrusted}`);
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -64,7 +64,9 @@ void AbortSignal::signal_abort(JS::Value reason)
|
||||||
m_abort_algorithms.clear();
|
m_abort_algorithms.clear();
|
||||||
|
|
||||||
// 5. Fire an event named abort at signal.
|
// 5. Fire an event named abort at signal.
|
||||||
dispatch_event(Event::create(realm(), HTML::EventNames::abort));
|
auto abort_event = Event::create(realm(), HTML::EventNames::abort);
|
||||||
|
abort_event->set_is_trusted(true);
|
||||||
|
dispatch_event(abort_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbortSignal::set_onabort(WebIDL::CallbackType* event_handler)
|
void AbortSignal::set_onabort(WebIDL::CallbackType* event_handler)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue