Add XPath parser/evaluator (#34463)

* Add XPath parser/evaluator

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* Correctly annotate XPathEvaluator IDL

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: have bindings pass in `can_gc`

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add docstrings

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: implement PartialEq for Value for readability

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add docstrings for CoreFunctions

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: simplify node test code

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add unit tests for string handling xpath functions

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* put xpath features behind dom.xpath.enabled pref

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review] remove rstest and insta dev-deps

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* update wpt test expectations

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: tweak metadata files

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* update wpt test expectations AGAIN

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

---------

Signed-off-by: Ville Lindholm <ville@lindholm.dev>
This commit is contained in:
Ville Lindholm 2024-12-08 04:01:50 +02:00 committed by GitHub
parent 264c0f972f
commit bc7fe41a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 6426 additions and 314 deletions

View file

@ -0,0 +1,3 @@
[document.tentative.html]
[XPath parent of documentElement]
expected: FAIL

View file

@ -0,0 +1,21 @@
[fn-lang.html]
[lang("en"): <root><match lang="en"></match></root>]
expected: FAIL
[lang("en"): <root><match lang="EN"></match></root>]
expected: FAIL
[lang("en"): <root><match lang="en-us"></match></root>]
expected: FAIL
[lang("en"): <root><unmatch></unmatch></root>]
expected: FAIL
[lang("ja"): <root lang="ja"><match></match></root>]
expected: FAIL
[lang("ja"): <root lang="ja-jp"><unmatch lang="ja_JP"></unmatch></root>]
expected: FAIL
[lang("ko"): <root><unmatch lang="o"></unmatch></root>]
expected: FAIL

View file

@ -0,0 +1,6 @@
[lexical-structure.html]
[Literal: Only ' and " should be handled as literal quotes.]
expected: FAIL
[ExprWhitespace: Only #x20 #x9 #xD or #xA must be handled as a whitespace.]
expected: FAIL

View file

@ -0,0 +1,3 @@
[node-sets.html]
[| operator should evaluate both sides of expressions with the same context node]
expected: FAIL

View file

@ -0,0 +1,3 @@
[predicates.html]
[An expression in a predicate should not change the context node]
expected: FAIL

View file

@ -0,0 +1,15 @@
[resolver-callback-interface-cross-realm.tentative.html]
[XPathNSResolver is cross-realm plain object without 'lookupNamespaceURI' property]
expected: FAIL
[XPathNSResolver is cross-realm plain object with non-callable 'lookupNamespaceURI' property]
expected: FAIL
[XPathNSResolver is cross-realm non-callable revoked Proxy]
expected: FAIL
[XPathNSResolver is cross-realm callable revoked Proxy]
expected: FAIL
[XPathNSResolver is cross-realm plain object with revoked Proxy as 'lookupNamespaceURI' property]
expected: FAIL

View file

@ -0,0 +1,30 @@
[resolver-callback-interface.html]
[callable resolver]
expected: FAIL
[callable resolver: result is not cached]
expected: FAIL
[callable resolver: abrupt completion from Call]
expected: FAIL
[callable resolver: no 'lookupNamespaceURI' lookups]
expected: FAIL
[object resolver]
expected: FAIL
[object resolver: this value and `prefix` argument]
expected: FAIL
[object resolver: 'lookupNamespaceURI' is not cached]
expected: FAIL
[object resolver: abrupt completion from Get]
expected: FAIL
[object resolver: 'lookupNamespaceURI' is thruthy and not callable]
expected: FAIL
[object resolver: 'lookupNamespaceURI' is falsy and not callable]
expected: FAIL

View file

@ -0,0 +1,18 @@
[resolver-non-string-result.html]
[undefined]
expected: FAIL
[null]
expected: FAIL
[number]
expected: FAIL
[boolean]
expected: FAIL
[symbol]
expected: FAIL
[object coercion (abrupt completion)]
expected: FAIL

View file

@ -0,0 +1,39 @@
[text-html-attributes.html]
[Select html element based on attribute]
expected: FAIL
[Select html element based on attribute mixed case]
expected: FAIL
[Select both HTML and SVG elements based on attribute]
expected: FAIL
[Select HTML element with non-ascii attribute 1]
expected: FAIL
[Select HTML element with non-ascii attribute 2]
expected: FAIL
[Select HTML element with non-ascii attribute 3]
expected: FAIL
[Select SVG element based on mixed case attribute]
expected: FAIL
[Select both HTML and SVG elements based on mixed case attribute]
expected: FAIL
[Select SVG elements with refX attribute]
expected: FAIL
[Select SVG element with non-ascii attribute 1]
expected: FAIL
[Select SVG element with non-ascii attribute 2]
expected: FAIL
[xmlns attribute]
expected: FAIL
[svg element with XLink attribute]
expected: FAIL

View file

@ -0,0 +1,24 @@
[text-html-elements.html]
[HTML elements namespace prefix]
expected: FAIL
[HTML elements mixed use of prefix]
expected: FAIL
[SVG elements namespace prefix]
expected: FAIL
[HTML elements mixed case]
expected: FAIL
[SVG elements mixed case selector]
expected: FAIL
[Non-ascii HTML element]
expected: FAIL
[Non-ascii HTML element3]
expected: FAIL
[Throw with invalid prefix]
expected: FAIL

File diff suppressed because it is too large Load diff