1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 13:44:58 +00:00

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.
This commit is contained in:
Andreas Kling 2022-03-19 14:22:46 +01:00
parent 462618b68c
commit 2c9dfadb21
3 changed files with 10 additions and 0 deletions

View file

@ -29,7 +29,10 @@ HTMLScriptElement::~HTMLScriptElement() = default;
void HTMLScriptElement::set_parser_document(Badge<HTMLParser>, DOM::Document& document)
{
m_parser_document = document;
}
void HTMLScriptElement::begin_delaying_document_load_event(Badge<HTMLParser>, DOM::Document& document)
{
// https://html.spec.whatwg.org/multipage/scripting.html#concept-script-script
// The user agent must delay the load event of the element's node document until the script is ready.
m_document_load_event_delayer.emplace(document);