Skip to content

xpath: Context node verification doesn't happen when using XPathEvaluator interface #40104

@simonwuelker

Description

@simonwuelker

Test case:

<!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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions