Skip to content

Conversation

@simonwuelker
Copy link
Contributor

@simonwuelker simonwuelker commented Oct 25, 2025

I always thought that exceptions thrown in namespace resolver callbacks should be propagated to the call site of document.evaluate.
That is not the case - the exception is silently swallowed and you get a namespace error, the same as if the callback had returned any other invalid value.

Testing: New web platform tests start to pass
Fixes #39931
Part of #34527

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
@simonwuelker simonwuelker force-pushed the xpath-namespace-resolution branch from a5ea140 to b85a604 Compare October 26, 2025 00:37
@simonwuelker simonwuelker marked this pull request as ready for review October 26, 2025 00:37
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 26, 2025
@simonwuelker
Copy link
Contributor Author

Needs some more investigation because some subtests in resolver-callback-interface.html do expect a type error to be thrown.

@simonwuelker simonwuelker marked this pull request as draft October 26, 2025 00:43
@simonwuelker
Copy link
Contributor Author

simonwuelker commented Oct 27, 2025

Chrome also fails those two remaining tests: https://wpt.fyi/results/domxpath/resolver-callback-interface.html?label=master&label=experimental&product=servo&product=firefox&product=chrome&aligned&q=domxpath

Firefox somehow throws both a type error and a namespace DOMException in the same document.evaluate call, which matches the test expectations. I wasn't able to replicate that, but if chrome isn't doing it then there's likely no point...

@simonwuelker simonwuelker marked this pull request as ready for review October 27, 2025 01:34
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 27, 2025
@jdm jdm added this pull request to the merge queue Oct 27, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 27, 2025
Merged via the queue into servo:main with commit d3fd90b Oct 27, 2025
34 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Being unable to resolve prefix during XPath evaluation should throw a namespace error

3 participants