|
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 type="application/javascript" 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;version=1.7"> |
|
19 |
|
20 /** Test for Bug 505915 **/ |
|
21 window.addEventListener("message", function () { gen.next() }, false); |
|
22 |
|
23 function go() { |
|
24 var ifr = $('ifr'); |
|
25 try { |
|
26 // NB: the contentDocument getter now returns null for cross-origin |
|
27 // frames, so use SpecialPowers to get a security wrapper to the document. |
|
28 var xdoc = SpecialPowers.unwrap(SpecialPowers.wrap(ifr).contentDocument) |
|
29 document.createTreeWalker(xdoc, 0, null); |
|
30 ok(false, "should have thrown a security exception"); |
|
31 } catch (e) { |
|
32 ok(/NS_ERROR_XPC_SECURITY_MANAGER_VETO/.test(e) || |
|
33 /TypeError: Argument 1 of Document.createTreeWalker does not implement interface Node/.test(e), |
|
34 "threw a security exception or binding exception instead of an " + |
|
35 "invalid child exception"); |
|
36 } |
|
37 |
|
38 SimpleTest.finish(); |
|
39 yield; |
|
40 } |
|
41 |
|
42 SimpleTest.waitForExplicitFinish(); |
|
43 |
|
44 </script> |
|
45 </pre> |
|
46 |
|
47 <iframe id="ifr" onload="gen = go(); gen.next();" src="http://example.org/"></iframe> |
|
48 |
|
49 </body> |
|
50 </html> |