From d25ffd3ed8e05d287f86052b495a8c460191bc80 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 27 May 2020 23:32:50 +0200 Subject: [PATCH] LibWeb: Fire a DOMContentLoaded event when the new parser is finished With this change, we can finally load and render welcome.html :^) --- Libraries/LibWeb/Parser/HTMLDocumentParser.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp index 6da146dec0..a4dfd4026d 100644 --- a/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp +++ b/Libraries/LibWeb/Parser/HTMLDocumentParser.cpp @@ -24,11 +24,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define PARSER_DEBUG + #include #include #include #include #include +#include #include #include #include @@ -65,12 +68,18 @@ void HTMLDocumentParser::run(const URL& url) for (;;) { auto optional_token = m_tokenizer.next_token(); if (!optional_token.has_value()) - return; + break; auto& token = optional_token.value(); +#ifdef PARSER_DEBUG dbg() << "[" << insertion_mode_name() << "] " << token.to_string(); +#endif process_using_the_rules_for(m_insertion_mode, token); } + + // "The end" + + m_document->dispatch_event(Event::create("DOMContentLoaded")); } void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token) @@ -543,7 +552,7 @@ void HTMLDocumentParser::run_the_adoption_agency_algorithm(HTMLToken& token) size_t outer_loop_counter = 0; -//OuterLoop: + //OuterLoop: if (outer_loop_counter >= 8) return;