file_iframe_sandbox_k_if1.html (1673B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test for Bug 766282</title> 6 <script src="/tests/SimpleTest/EventUtils.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 </head> 9 <script type="text/javascript"> 10 var windowsToClose = new Array(); 11 12 function closeWindows() { 13 for (var i = 0; i < windowsToClose.length; i++) { 14 windowsToClose[i].close(); 15 } 16 window.open("file_iframe_sandbox_close.html", "blank_if2"); 17 window.open("file_iframe_sandbox_close.html", "BC766282_if2"); 18 } 19 20 // Add message listener to forward messages on to parent 21 window.addEventListener("message", receiveMessage); 22 23 function receiveMessage(event) { 24 switch (event.data.type) { 25 case "closeWindows": 26 closeWindows(); 27 break; 28 } 29 } 30 31 function doStuff() { 32 // Open a new window via target="_blank", target="BC766282_if2" and window.open(). 33 sendMouseEvent({type:'click'}, 'target_blank_if2'); 34 sendMouseEvent({type:'click'}, 'target_BC766282_if2'); 35 36 windowsToClose.push(window.open("file_iframe_sandbox_k_if2.html")); 37 } 38 </script> 39 <body onLoad="doStuff()"> 40 I am navigated to from file_iframe_sandbox_k_if8.html. 41 This was opened in an iframe with "allow-scripts allow-popups allow-same-origin". 42 However allow-same-origin was removed from the iframe before navigating to me, 43 so I should only have "allow-scripts allow-popups" in force. 44 <a href="file_iframe_sandbox_k_if2.html" target="_blank" id="target_blank_if2" rel="opener">open window</a> 45 <a href="file_iframe_sandbox_k_if2.html" target="BC766282_if2" id="target_BC766282_if2">open window</a> 46 </body> 47 </html>