Skip to content

Commit e9e58d8

Browse files
johannesggmta
authored andcommitted
LibWeb: Add WPT tests related to XPath evaluation
1 parent d2030a5 commit e9e58d8

File tree

64 files changed

+37681
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+37681
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
3+
<head>
4+
<link rel="help" href="https://github.com/servo/servo/issues/36971">
5+
<meta name="assert" content="Using variables in xpath expression should not crash.">
6+
</head>
7+
<body>
8+
<script>
9+
// The exact behaviour here is not defined. Firefox throws an error, Chrome doesn't.
10+
document.evaluate("$foo", document.createElement("div"));
11+
</script>
12+
</body>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>Evaluating XPath expressions with orhpaned Attr as context node doesn't crash</title>
4+
<link rel=author href="mailto:jarhar@chromium.org">
5+
<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1236967">
6+
<script src="../resources/testharnessreport.js"></script>
7+
<body>
8+
<script>
9+
for (const expression of [
10+
"..",
11+
"parent",
12+
"ancestor::*",
13+
"ancestor-or-self::*",
14+
"following::*",
15+
"preceding::*",
16+
]) {
17+
const orphanedAttr = document.createAttribute("foo");
18+
new XPathEvaluator().evaluate(expression, orphanedAttr, null, 2);
19+
}
20+
</script>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Harness status: OK
2+
3+
Found 7 tests
4+
5+
7 Pass
6+
Pass "or" operator depending on the context node
7+
Pass "=" operator depending on the context node
8+
Pass "!=" operator depending on the context node
9+
Pass "<" operator depending on the context node
10+
Pass ">" operator depending on the context node
11+
Pass ">=" operator depending on the context node
12+
Pass "<=" operator depending on the context node
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Harness status: OK
2+
3+
Found 1 tests
4+
5+
1 Pass
6+
Pass XPath parent of documentElement
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Harness status: OK
2+
3+
Found 2 tests
4+
5+
2 Pass
6+
Pass Constructor with 'new'
7+
Pass Constructor without 'new'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Harness status: OK
2+
3+
Found 4 tests
4+
5+
4 Fail
6+
Fail evaluator from realm with XML associated document, context node in XML document, no namespace resolver
7+
Fail evaluator from realm with XML associated document, context node in HTML document, no namespace resolver
8+
Fail evaluator from realm with HTML associated document, context node in XML document, no namespace resolver
9+
Fail evaluator from realm with HTML associated document, context node in HTML document, no namespace resolver
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Harness status: OK
2+
3+
Found 8 tests
4+
5+
4 Pass
6+
4 Fail
7+
Fail evaluate operation on XML document, context node in XML document, no namespace resolver
8+
Pass evaluate operation on HTML document, context node in HTML document, no namespace resolver
9+
Pass evaluate operation on XML document, context node in HTML document, no namespace resolver
10+
Fail evaluate operation on HTML document, context node in XML document, no namespace resolver
11+
Fail evaluate operation on XML document, context node in XML document, with namespace resolver
12+
Pass evaluate operation on HTML document, context node in HTML document, with namespace resolver
13+
Pass evaluate operation on XML document, context node in HTML document, with namespace resolver
14+
Fail evaluate operation on HTML document, context node in XML document, with namespace resolver
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Harness status: OK
2+
3+
Found 4 tests
4+
5+
4 Fail
6+
Fail expression from realm with XML associated document, context node in XML document, no namespace resolver
7+
Fail expression from realm with XML associated document, context node in HTML document, no namespace resolver
8+
Fail expression from realm with HTML associated document, context node in XML document, no namespace resolver
9+
Fail expression from realm with HTML associated document, context node in HTML document, no namespace resolver
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Harness status: OK
2+
3+
Found 8 tests
4+
5+
4 Pass
6+
4 Fail
7+
Fail expression from XML document, context node in XML document, no namespace resolver
8+
Pass expression from HTML document, context node in HTML document, no namespace resolver
9+
Pass expression from XML document, context node in HTML document, no namespace resolver
10+
Fail expression from HTML document, context node in XML document, no namespace resolver
11+
Fail expression from XML document, context node in XML document, with namespace resolver
12+
Pass expression from HTML document, context node in HTML document, with namespace resolver
13+
Pass expression from XML document, context node in HTML document, with namespace resolver
14+
Fail expression from HTML document, context node in XML document, with namespace resolver
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Harness status: OK
2+
3+
Found 1 tests
4+
5+
1 Pass
6+
Pass concat() arguments depending on the context node

0 commit comments

Comments
 (0)