file_iframe_sandbox_e_if14.html (868B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test for Bug 838692</title> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 7 </head> 8 <script> 9 function doTest() { 10 var testContext = location.search.substring(1); 11 try { 12 var topsOpener = window.top.opener; 13 window.open("file_iframe_sandbox_top_navigation_fail.html?" + testContext, "_top"); 14 topsOpener.postMessage({ok: false, desc: unescape(testContext) + "top navigation should NOT be allowed by a document sandboxed without 'allow-top-navigation.'"}, "*"); 15 } catch(error) { 16 window.top.opener.postMessage({ok: true, desc: unescape(testContext) + "as expected error thrown during window.open(..., \"_top\")"}, "*"); 17 window.top.close(); 18 } 19 } 20 </script> 21 <body onload="doTest()"> 22 I am sandboxed with 'allow-scripts' 23 </body> 24 </html>