Source code

Revision control

Other Tools

1
<!DOCTYPE HTML>
2
<html>
3
<!--
5
-->
6
<head>
7
<title>Test for Bug 505915</title>
8
<script src="/tests/SimpleTest/SimpleTest.js"></script>
9
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10
</head>
11
<body>
12
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=505915">Mozilla Bug 505915</a>
13
<p id="display"></p>
14
<div id="content" style="display: none">
15
16
</div>
17
<pre id="test">
18
<script type="application/javascript">
19
20
/** Test for Bug 505915 **/
21
window.addEventListener("message", function () {
22
ok(false, "should not receive message");
23
});
24
25
function go() {
26
var ifr = $('ifr');
27
try {
28
// NB: the contentDocument getter now returns null for cross-origin
29
// frames, so use SpecialPowers to get a security wrapper to the document.
30
var xdoc = SpecialPowers.unwrap(SpecialPowers.wrap(ifr).contentDocument)
31
document.createTreeWalker(xdoc, 0, null);
32
ok(false, "should have thrown a security exception");
33
} catch (e) {
34
ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e) ||
35
/TypeError: Argument 1 of Document.createTreeWalker does not implement interface Node/.test(e),
36
"threw a security exception or binding exception instead of an " +
37
"invalid child exception");
38
}
39
40
SimpleTest.finish();
41
}
42
43
SimpleTest.waitForExplicitFinish();
44
45
</script>
46
</pre>
47
48
<iframe id="ifr" onload="go();" src="http://test1.mochi.test:8888/"></iframe>
49
50
</body>
51
</html>