diff options
author | Andreas Kling <kling@serenityos.org> | 2022-03-19 14:22:46 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-19 15:04:48 +0100 |
commit | 2c9dfadb21e3eee05e248a5c4a5c46381dcaa1e5 (patch) | |
tree | 109a1cf53d8c270d62b14a842974ae9d11990e92 /Userland/Libraries/LibWeb/HTML/Parser | |
parent | 462618b68c0b11d169262c30e4cdad9e4065f059 (diff) | |
download | serenity-2c9dfadb21e3eee05e248a5c4a5c46381dcaa1e5.zip |
LibWeb: Don't delay document "load" event for unclosed script tags
We previously had a bug where markup with unclosed script tags caused
the document load event to be delayed indefinitely. Fix this by only
marking script elements as delaying the load event once we encounter
the script end tag.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 2541298c7b..a2b41c4540 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -2093,6 +2093,11 @@ void HTMLParser::handle_text(HTMLToken& token) flush_character_insertions(); NonnullRefPtr<HTMLScriptElement> script = verify_cast<HTMLScriptElement>(current_node()); + + // The document's "load" event is delayed until every script becomes ready. + // See HTMLScriptElement internals for how readiness is determined. + script->begin_delaying_document_load_event({}, *m_document); + (void)m_stack_of_open_elements.pop(); m_insertion_mode = m_original_insertion_mode; // Let the old insertion point have the same value as the current insertion point. |