forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexception-forwarding.html
41 lines (38 loc) · 1.34 KB
/
exception-forwarding.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Test of exception forwarding for NodeIterator and TreeWalker, derived from an early version of Acid3");
var iteration = 0;
function test(node)
{
iteration += 1;
switch (iteration) {
case 1: case 3: case 4: case 6: case 7: case 8: case 9: case 12: throw "Roses";
case 2: case 5: case 10: case 11: return true;
default: throw 0;
}
}
var i = document.createNodeIterator(document.documentElement, 0xFFFFFFFF, test, true);
shouldThrow("i.nextNode()"); // 1
shouldBe("i.nextNode()", "document.documentElement"); // 2
shouldThrow("i.previousNode()"); // 3
var w = document.createTreeWalker(document.documentElement, 0xFFFFFFFF, test, true);
shouldThrow("w.nextNode()"); // 4
shouldBe("w.nextNode()", "document.documentElement.firstChild"); // 5
shouldThrow("w.previousNode()"); // 6
shouldThrow("w.firstChild()"); // 7
shouldThrow("w.lastChild()"); // 8
shouldThrow("w.nextSibling()"); // 9
shouldBe("w.previousSibling()", "null");
shouldBe("w.nextSibling()", "document.body.previousSibling"); // 10
shouldBe("w.previousSibling()", "document.head"); // 11
shouldBe("iteration", "11");
var successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>