<!DOCTYPE html>
<body>
<div id="context"></div>
<script>
let root = document.getElementById("context").attachShadow({mode: "open"});
try {
document.evaluate(".", root, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
console.log("should have thrown")
} catch {}
try {
let expression = (new XPathEvaluator).createExpression(".", null)
expression.evaluate(root, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
console.log("should have thrown")
} catch {}
</script>
</body>
Servo does not throw in the second case, despite trying to perform the same operation as in the first one.