Skip to content

Truly independent web browser

Meta+Tests: Import the scripts that SVG script elements reference

Luke Wilde859977ac1223
diff --git a/Meta/import-wpt-test.py b/Meta/import-wpt-test.py
index b6cdca4e2d7..340445b40f0 100755
--- a/Meta/import-wpt-test.py
+++ b/Meta/import-wpt-test.py
@@ -102,6 +102,11 @@ class LinkedResourceFinder(HTMLParser):
attr_dict = dict(attrs)
if "src" in attr_dict:
self._resources.add(attr_dict["src"])
+ # An SVG script element names its script with href or xlink:href.
+ if tag == "script":
+ for name in ["href", "xlink:href"]:
+ if name in attr_dict:
+ self._resources.add(attr_dict[name])
if tag == "link":
attr_dict = dict(attrs)
if "rel" in attr_dict and attr_dict["rel"] == "stylesheet":
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/unclosed-svg-script.txt b/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/unclosed-svg-script.txt
index 6055c864758..cf66d8468d6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/unclosed-svg-script.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/unclosed-svg-script.txt
@@ -1,3 +1,10 @@
-Harness status: Error
+Harness status: OK
-Found 0 tests
+Found 5 tests
+
+5 Pass
+Pass SVG scripts with end tag should run
+Pass SVG scripts without end tag should not run
+Pass SVG scripts with bogus end tag inside should run
+Pass SVG scripts ended by HTML breakout should not run
+Pass SVG scripts with self-closing start tag should run
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/html/syntax/parsing/support/svg-script-self-closing.js b/Tests/LibWeb/Text/input/wpt-import/html/syntax/parsing/support/svg-script-self-closing.js
new file mode 100644
index 00000000000..6dd286e7bc0
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/html/syntax/parsing/support/svg-script-self-closing.js
@@ -0,0 +1 @@
+scriptSelfClosing = true;