test_bug1126911.html (1079B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1126911 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1126911</title> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="chrome://global/skin"/> 11 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 12 <script type="application/javascript"> 13 14 /** Test for Bug 1126911 */ 15 var sb = new Cu.Sandbox(null); 16 sb.win = window; 17 sb.loc = location; 18 function checkThrows(expr) { 19 try { 20 Cu.evalInSandbox(expr, sb); 21 ok(false, "Should have thrown: " + expr); 22 } catch (e) { 23 ok(/denied|insecure/.test(e), "should get security exception: " + e); 24 } 25 } 26 checkThrows('win.top'); 27 checkThrows('loc.replace'); 28 29 </script> 30 </head> 31 <body> 32 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1126911">Mozilla Bug 1126911</a> 33 <p id="display"></p> 34 <div id="content" style="display: none"> 35 36 </div> 37 <pre id="test"> 38 </pre> 39 </body> 40 </html>