When the provided xpath result type is `XPathResult.ANY_TYPE` then we
need to infer the result type from the result value. Previously we were
doing this in the XPathResult constructor, but that isn't being called
when we reuse a result. Instead, we move the inferring to right after we
evaluate an expression.
Testing: This change adds a new test
Fixes https://github.com/servo/servo/issues/39955
Part of #34527
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>