js/xpconnect/tests/mochitest/test_bug396851.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:d1850c63c117
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=396851
5 -->
6 <head>
7 <title>Test for Bug 396851</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10
11 <script type="text/javascript">
12 function go() {
13 var iframe = $("ifr");
14 var win = iframe.contentWindow;
15 try {
16 var doc = win.document;
17 fail("Allowed cross-origin access to the document");
18 } catch (e) {
19 ok(e.toString().match("Permission denied") != null, "Weird exception thrown");
20 }
21
22 doc = SpecialPowers.wrap(win).document;
23 ok(doc != null, "Able to access the cross-origin document");
24 SimpleTest.finish();
25 }
26 </script>
27 </head>
28 <body>
29 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=396851">Mozilla Bug 396851</a>
30 <p id="display"></p>
31 <div id="content" style="display: none">
32 </div>
33 <script type="text/javascript">
34 SimpleTest.waitForExplicitFinish();
35 </script>
36 <iframe id="ifr"
37 src="http://example.org/tests/js/xpconnect/tests/mochitest/inner.html"
38 onload="go()">
39 </iframe>
40 </body>
41 </html>

mercurial