mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-30 14:20:21 +00:00
LibWeb: Use as
to cast global object to WindowOrWorkerGlobalScopeMixin
No functional changes.
This commit is contained in:
parent
3794665b0b
commit
6d7b7e7822
Notes:
github-actions[bot]
2025-02-02 16:19:57 +00:00
Author: https://github.com/tcl3
Commit: 6d7b7e7822
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3428
Reviewed-by: https://github.com/gmta ✅
10 changed files with 30 additions and 44 deletions
|
@ -151,11 +151,10 @@ WebIDL::ExceptionOr<GC::Ref<AbortSignal>> AbortSignal::timeout(JS::VM& vm, WebID
|
|||
|
||||
// 2. Let global be signal’s relevant global object.
|
||||
auto& global = HTML::relevant_global_object(signal);
|
||||
auto* window_or_worker = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&global);
|
||||
VERIFY(window_or_worker);
|
||||
auto& window_or_worker = as<HTML::WindowOrWorkerGlobalScopeMixin>(global);
|
||||
|
||||
// 3. Run steps after a timeout given global, "AbortSignal-timeout", milliseconds, and the following step:
|
||||
window_or_worker->run_steps_after_a_timeout(milliseconds, [&realm, &global, signal]() {
|
||||
window_or_worker.run_steps_after_a_timeout(milliseconds, [&realm, &global, signal]() {
|
||||
// 1. Queue a global task on the timer task source given global to signal abort given signal and a new "TimeoutError" DOMException.
|
||||
HTML::queue_global_task(HTML::Task::Source::TimerTask, global, GC::create_function(realm.heap(), [&realm, signal]() mutable {
|
||||
auto reason = WebIDL::TimeoutError::create(realm, "Signal timed out"_string);
|
||||
|
|
|
@ -3850,8 +3850,7 @@ Vector<GC::Root<HTML::Navigable>> Document::document_tree_child_navigables()
|
|||
void Document::run_unloading_cleanup_steps()
|
||||
{
|
||||
// 1. Let window be document's relevant global object.
|
||||
auto* window = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&HTML::relevant_global_object(*this));
|
||||
VERIFY(window);
|
||||
auto& window = as<HTML::WindowOrWorkerGlobalScopeMixin>(HTML::relevant_global_object(*this));
|
||||
|
||||
// FIXME: 2. For each WebSocket object webSocket whose relevant global object is window, make disappear webSocket.
|
||||
// If this affected any WebSocket objects, then set document's salvageable state to false.
|
||||
|
@ -3861,10 +3860,10 @@ void Document::run_unloading_cleanup_steps()
|
|||
// 4. If document's salvageable state is false, then:
|
||||
if (!m_salvageable) {
|
||||
// 1. For each EventSource object eventSource whose relevant global object is equal to window, forcibly close eventSource.
|
||||
window->forcibly_close_all_event_sources();
|
||||
window.forcibly_close_all_event_sources();
|
||||
|
||||
// 2. Clear window's map of active timers.
|
||||
window->clear_map_of_active_timers();
|
||||
window.clear_map_of_active_timers();
|
||||
}
|
||||
|
||||
FileAPI::run_unloading_cleanup_steps(*this);
|
||||
|
|
|
@ -96,9 +96,8 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<GC::Root<DOM::DOMEventLi
|
|||
// If this throws an exception, then:
|
||||
if (result.is_error()) {
|
||||
// 1. Report exception for listener’s callback’s corresponding JavaScript object’s associated realm’s global object.
|
||||
auto* window_or_worker = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&global);
|
||||
VERIFY(window_or_worker);
|
||||
window_or_worker->report_an_exception(*result.release_error().value());
|
||||
auto& window_or_worker = as<HTML::WindowOrWorkerGlobalScopeMixin>(global);
|
||||
window_or_worker.report_an_exception(*result.release_error().value());
|
||||
|
||||
// 2. Set legacyOutputDidListenersThrowFlag if given. (Only used by IndexedDB currently)
|
||||
legacy_output_did_listeners_throw = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue