Skip to content

Truly independent web browser

LibWeb: Extract the origin of MathML `<a>` elements in `Origin.from()`

Tim Ledbetterf1ca6ea86b25
diff --git a/Libraries/LibWeb/MathML/MathMLAnchorElement.h b/Libraries/LibWeb/MathML/MathMLAnchorElement.h
index 9cf5e89a3a3..a697ec2ccbd 100644
--- a/Libraries/LibWeb/MathML/MathMLAnchorElement.h
+++ b/Libraries/LibWeb/MathML/MathMLAnchorElement.h
@@ -22,6 +22,8 @@ class MathMLAnchorElement final
public:
virtual ~MathMLAnchorElement() override;
+ virtual Optional<URL::Origin> extract_an_origin() const override { return hyperlink_element_utils_extract_an_origin(); }
+
virtual bool is_mathml_anchor_element() const override { return true; }
// ^EventTarget
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/browsers/origin/api/origin-from-hyperlinkelementutils.window.txt b/Tests/LibWeb/Text/expected/wpt-import/html/browsers/origin/api/origin-from-hyperlinkelementutils.window.txt
index 27ac69377dd..b58ad183438 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/html/browsers/origin/api/origin-from-hyperlinkelementutils.window.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/browsers/origin/api/origin-from-hyperlinkelementutils.window.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 129 tests
-104 Pass
-25 Fail
+129 Pass
Pass Origin.from(<a>) throws.
Pass Origin.from(<area>) throws.
Pass Origin.from(SVG <a>) throws.
@@ -12,124 +11,124 @@ Pass Origin.from(<a href="about:blank">) returns an opaque origin.
Pass Origin.from(<area href="about:blank">) returns an opaque origin.
Pass Origin.from(SVG <a href="about:blank">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="about:blank">) returns an opaque origin.
-Fail Origin.from(MathML <a href="about:blank">) returns an opaque origin.
+Pass Origin.from(MathML <a href="about:blank">) returns an opaque origin.
Pass Origin.from(<a href="data:text/plain,opaque">) returns an opaque origin.
Pass Origin.from(<area href="data:text/plain,opaque">) returns an opaque origin.
Pass Origin.from(SVG <a href="data:text/plain,opaque">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="data:text/plain,opaque">) returns an opaque origin.
-Fail Origin.from(MathML <a href="data:text/plain,opaque">) returns an opaque origin.
+Pass Origin.from(MathML <a href="data:text/plain,opaque">) returns an opaque origin.
Pass Origin.from(<a href="weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(<area href="weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(SVG <a href="weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="weird-protocol:whatever">) returns an opaque origin.
-Fail Origin.from(MathML <a href="weird-protocol:whatever">) returns an opaque origin.
+Pass Origin.from(MathML <a href="weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(<a href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(<area href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(SVG <a href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
-Fail Origin.from(MathML <a href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
+Pass Origin.from(MathML <a href="weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(<a href="blob:weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(<area href="blob:weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(SVG <a href="blob:weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="blob:weird-protocol:whatever">) returns an opaque origin.
-Fail Origin.from(MathML <a href="blob:weird-protocol:whatever">) returns an opaque origin.
+Pass Origin.from(MathML <a href="blob:weird-protocol:whatever">) returns an opaque origin.
Pass Origin.from(<a href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(<area href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(SVG <a href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(SVG <a xlink:href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
-Fail Origin.from(MathML <a href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
+Pass Origin.from(MathML <a href="blob:weird-hierarchical-protocol://host/path?etc">) returns an opaque origin.
Pass Origin.from(<a href="http://site.example">) returns a tuple origin.
Pass Origin.from(<area href="http://site.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="http://site.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="http://site.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="http://site.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="http://site.example">) returns a tuple origin.
Pass Origin.from(<a href="https://site.example">) returns a tuple origin.
Pass Origin.from(<area href="https://site.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://site.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://site.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://site.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://site.example">) returns a tuple origin.
Pass Origin.from(<a href="https://site.example:123">) returns a tuple origin.
Pass Origin.from(<area href="https://site.example:123">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://site.example:123">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://site.example:123">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://site.example:123">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://site.example:123">) returns a tuple origin.
Pass Origin.from(<a href="http://sub.site.example">) returns a tuple origin.
Pass Origin.from(<area href="http://sub.site.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="http://sub.site.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="http://sub.site.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="http://sub.site.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="http://sub.site.example">) returns a tuple origin.
Pass Origin.from(<a href="https://sub.site.example">) returns a tuple origin.
Pass Origin.from(<area href="https://sub.site.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://sub.site.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://sub.site.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://sub.site.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://sub.site.example">) returns a tuple origin.
Pass Origin.from(<a href="https://sub.site.example:123">) returns a tuple origin.
Pass Origin.from(<area href="https://sub.site.example:123">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://sub.site.example:123">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://sub.site.example:123">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://sub.site.example:123">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://sub.site.example:123">) returns a tuple origin.
Pass Origin.from(<a href="https://xn--mlauted-m2a.example">) returns a tuple origin.
Pass Origin.from(<area href="https://xn--mlauted-m2a.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://xn--mlauted-m2a.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://xn--mlauted-m2a.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://xn--mlauted-m2a.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://xn--mlauted-m2a.example">) returns a tuple origin.
Pass Origin.from(<a href="ftp://ftp.example">) returns a tuple origin.
Pass Origin.from(<area href="ftp://ftp.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="ftp://ftp.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="ftp://ftp.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="ftp://ftp.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="ftp://ftp.example">) returns a tuple origin.
Pass Origin.from(<a href="ws://ws.example">) returns a tuple origin.
Pass Origin.from(<area href="ws://ws.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="ws://ws.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="ws://ws.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="ws://ws.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="ws://ws.example">) returns a tuple origin.
Pass Origin.from(<a href="wss://wss.example">) returns a tuple origin.
Pass Origin.from(<area href="wss://wss.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="wss://wss.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="wss://wss.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="wss://wss.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="wss://wss.example">) returns a tuple origin.
Pass Origin.from(<a href="https://trailing.slash/">) returns a tuple origin.
Pass Origin.from(<area href="https://trailing.slash/">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://trailing.slash/">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://trailing.slash/">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://trailing.slash/">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://trailing.slash/">) returns a tuple origin.
Pass Origin.from(<a href="https://user:[email protected]">) returns a tuple origin.
Pass Origin.from(<area href="https://user:[email protected]">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://user:[email protected]">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://user:[email protected]">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://user:[email protected]">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://user:[email protected]">) returns a tuple origin.
Pass Origin.from(<a href="https://has.a.port:1234/and/path">) returns a tuple origin.
Pass Origin.from(<area href="https://has.a.port:1234/and/path">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://has.a.port:1234/and/path">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://has.a.port:1234/and/path">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://has.a.port:1234/and/path">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://has.a.port:1234/and/path">) returns a tuple origin.
Pass Origin.from(<a href="https://ümlauted.example">) returns a tuple origin.
Pass Origin.from(<area href="https://ümlauted.example">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://ümlauted.example">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://ümlauted.example">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://ümlauted.example">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://ümlauted.example">) returns a tuple origin.
Pass Origin.from(<a href="blob:https://example.com/some-guid">) returns a tuple origin.
Pass Origin.from(<area href="blob:https://example.com/some-guid">) returns a tuple origin.
Pass Origin.from(SVG <a href="blob:https://example.com/some-guid">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="blob:https://example.com/some-guid">) returns a tuple origin.
-Fail Origin.from(MathML <a href="blob:https://example.com/some-guid">) returns a tuple origin.
+Pass Origin.from(MathML <a href="blob:https://example.com/some-guid">) returns a tuple origin.
Pass Origin.from(<a href="ftp://example.com/">) returns a tuple origin.
Pass Origin.from(<area href="ftp://example.com/">) returns a tuple origin.
Pass Origin.from(SVG <a href="ftp://example.com/">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="ftp://example.com/">) returns a tuple origin.
-Fail Origin.from(MathML <a href="ftp://example.com/">) returns a tuple origin.
+Pass Origin.from(MathML <a href="ftp://example.com/">) returns a tuple origin.
Pass Origin.from(<a href="https://example.com/path?query#fragment">) returns a tuple origin.
Pass Origin.from(<area href="https://example.com/path?query#fragment">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://example.com/path?query#fragment">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://example.com/path?query#fragment">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://example.com/path?query#fragment">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://example.com/path?query#fragment">) returns a tuple origin.
Pass Origin.from(<a href="https://127.0.0.1/">) returns a tuple origin.
Pass Origin.from(<area href="https://127.0.0.1/">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://127.0.0.1/">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://127.0.0.1/">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://127.0.0.1/">) returns a tuple origin.
+Pass Origin.from(MathML <a href="https://127.0.0.1/">) returns a tuple origin.
Pass Origin.from(<a href="https://[::1]/">) returns a tuple origin.
Pass Origin.from(<area href="https://[::1]/">) returns a tuple origin.
Pass Origin.from(SVG <a href="https://[::1]/">) returns a tuple origin.
Pass Origin.from(SVG <a xlink:href="https://[::1]/">) returns a tuple origin.
-Fail Origin.from(MathML <a href="https://[::1]/">) returns a tuple origin.
\ No newline at end of file
+Pass Origin.from(MathML <a href="https://[::1]/">) returns a tuple origin.
\ No newline at end of file