Backed out changeset 713114c0331a (bug 1938707) by developer request CLOSED TREE
[gecko.git] / js / xpconnect / tests / mochitest / test_bug505915.html
blobd5898bc1ed45ae88e9176fa2166db7110727f3a8
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=505915
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">
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
20 /** Test for Bug 505915 **/
21 window.addEventListener("message", function () {
22 ok(false, "should not receive message");
23 });
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(/TypeError: Document.createTreeWalker: Argument 1 does not implement interface Node/.test(e),
35 "threw a binding exception instead of an invalid child exception");
38 SimpleTest.finish();
41 SimpleTest.waitForExplicitFinish();
43 </script>
44 </pre>
46 <iframe id="ifr" onload="go();" src="http://test1.mochi.test:8888/"></iframe>
48 </body>
49 </html>