test_bug505915.html (1421B)
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"> 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(/TypeError: Document.createTreeWalker: Argument 1 does not implement interface Node/.test(e), 35 "threw a binding exception instead of an invalid child exception"); 36 } 37 38 SimpleTest.finish(); 39 } 40 41 SimpleTest.waitForExplicitFinish(); 42 43 </script> 44 </pre> 45 46 <iframe id="ifr" onload="go();" src="http://test1.mochi.test:8888/"></iframe> 47 48 </body> 49 </html>