test_bug636097.html (1381B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=504877 5 test by moz_bug_r_a4@yahoo.com 6 --> 7 <head> 8 <title>Test for Bug 504877</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504877">Mozilla Bug 504877</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 504877 **/ 22 SimpleTest.waitForExplicitFinish(); 23 24 var targetUrl = "http://example.com/"; 25 var l; 26 27 function a() { 28 var r = "FAIL", s; 29 try { 30 s = l.toString(); 31 } 32 catch (e) { 33 if (/denied|insecure/.test(e)) 34 r = "PASS"; 35 s = e; 36 } 37 38 is(r, "PASS", "should have thrown an exception"); 39 SimpleTest.finish(); 40 } 41 42 var p = 0; 43 function b() { 44 switch (++p) { 45 case 1: 46 frames[0].location = "about:blank"; 47 break; 48 case 2: 49 l = frames[0].location; 50 frames[0].location = targetUrl; 51 break; 52 case 3: 53 a(); 54 break; 55 } 56 } 57 </script> 58 59 </pre> 60 <iframe onload="b()"></iframe> 61 </body> 62 </html>