blob: 17f77201992a97925db2c4034338152ae2eea4ba (
plain)
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
|
<html>
<head>
<script src="../js/resources/js-test-pre.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
var dummyResolverCalled = false;
var foundNode;
function dummyResolver() {
dummyResolverCalled = true;
return "http://www.w3.org/1999/xhtml";
}
function test() {
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var doc = iframe.contentWindow.document;
doc.open();
doc.write("<html><body><div></div></body></html>");
doc.close();
document.body.removeChild(iframe);
foundNode = doc.evaluate("//dummyns:div", doc, dummyResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
testPassed("Did not crash.");
shouldBeTrue("dummyResolverCalled");
shouldBe("foundNode.toString()", "\"[object HTMLDivElement]\"");
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</head>
<body onload="test()">
<p>Ensure that using XPath namespace resolver with a detached iframe doesn't crash.</p>
<div id="console"></div>
</body>
</html>
|