Skip to content

Truly independent web browser

LibWeb: Process a parsed empty SVG script when text is added to it

Andreas Klingc80f5820bb48
diff --git a/Libraries/LibWeb/SVG/SVGScriptElement.cpp b/Libraries/LibWeb/SVG/SVGScriptElement.cpp
index 7b8a9e3b72d..af070c7ae32 100644
--- a/Libraries/LibWeb/SVG/SVGScriptElement.cpp
+++ b/Libraries/LibWeb/SVG/SVGScriptElement.cpp
@@ -150,8 +150,12 @@ void SVGScriptElement::process_the_script_element()
}
auto script_content = child_text_content();
- if (script_content.is_empty())
+ if (script_content.is_empty()) {
+ // AD-HOC: The parser is done with an empty script once it gets here, so a later change to the script's
+ // children should process it like for a script that the parser did not insert.
+ m_parser_inserted = false;
return;
+ }
// 3. The 'script' element's "already processed" flag is set to true.
m_already_processed = true;
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/145.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/145.txt
index 46c5a3af7fb..96490443248 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/145.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/145.txt
@@ -2,5 +2,5 @@ Harness status: OK
Found 1 tests
-1 Fail
-Fail scheduler: SVG inline script adding text to empty script
\ No newline at end of file
+1 Pass
+Pass scheduler: SVG inline script adding text to empty script
\ No newline at end of file