file_iframe_sandbox_k_if1.html 1.7 KB

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