diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 277e678b3c..0784e99ec5 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -193,6 +193,8 @@ public: void removed_last_ref(); + Window& window() { return *m_window; } + private: virtual RefPtr create_layout_node(const CSS::StyleProperties* parent_style) override; diff --git a/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp index 2f204692b6..7de6600c8d 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,10 @@ void HTMLDocumentParser::run(const URL& url) m_document->dispatch_event(DOM::Event::create("DOMContentLoaded")); + // FIXME: These are not in the right place, they should only fire once subresources are ready. + m_document->dispatch_event(DOM::Event::create("load")); + m_document->window().dispatch_event(DOM::Event::create("load")); + auto scripts_to_execute_as_soon_as_possible = m_document->take_scripts_to_execute_as_soon_as_possible({}); for (auto& script : scripts_to_execute_as_soon_as_possible) { script.execute_script();