1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibWeb: Remove unecessary dependence on Window from assorted classes

These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
This commit is contained in:
Andrew Kaster 2022-09-25 18:11:21 -06:00 committed by Linus Groh
parent 4878a18ee7
commit 4bb6345b2f
30 changed files with 125 additions and 126 deletions

View file

@ -177,7 +177,7 @@ void XMLDocumentBuilder::document_end()
document->load_timing_info().dom_content_loaded_event_start_time = HTML::main_thread_event_loop().unsafe_shared_current_time();
// Fire an event named DOMContentLoaded at the Document object, with its bubbles attribute initialized to true.
auto content_loaded_event = DOM::Event::create(document->window(), HTML::EventNames::DOMContentLoaded);
auto content_loaded_event = DOM::Event::create(document->realm(), HTML::EventNames::DOMContentLoaded);
content_loaded_event->set_bubbles(true);
document->dispatch_event(*content_loaded_event);
@ -209,7 +209,7 @@ void XMLDocumentBuilder::document_end()
return;
// Let window be the Document's relevant global object.
JS::NonnullGCPtr<HTML::Window> window = document->window();
JS::NonnullGCPtr<HTML::Window> window = verify_cast<HTML::Window>(relevant_global_object(*document));
// Set the Document's load timing info's load event start time to the current high resolution time given window.
document->load_timing_info().load_event_start_time = HTML::main_thread_event_loop().unsafe_shared_current_time();
@ -217,7 +217,7 @@ void XMLDocumentBuilder::document_end()
// Fire an event named load at window, with legacy target override flag set.
// FIXME: The legacy target override flag is currently set by a virtual override of dispatch_event()
// We should reorganize this so that the flag appears explicitly here instead.
window->dispatch_event(*DOM::Event::create(document->window(), HTML::EventNames::load));
window->dispatch_event(*DOM::Event::create(document->realm(), HTML::EventNames::load));
// FIXME: Invoke WebDriver BiDi load complete with the Document's browsing context, and a new WebDriver BiDi navigation status whose id is the Document object's navigation id, status is "complete", and url is the Document object's URL.