file_iframe_sandbox_c_if1.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Test for Bug 341604</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. function ok(result, desc) {
  11. window.parent.postMessage({ok: result, desc: desc}, "*");
  12. }
  13. function doStuff() {
  14. ok(true, "documents sandboxed with allow-scripts should be able to run inline scripts");
  15. document.getElementById('a_form').submit();
  16. // trigger the javascript: url test
  17. sendMouseEvent({type:'click'}, 'a_link');
  18. }
  19. </script>
  20. <script src='file_iframe_sandbox_pass.js'></script>
  21. <body onLoad='ok(true, "documents sandboxed with allow-scripts should be able to run script from event listeners");doStuff();'>
  22. I am sandboxed but with "allow-scripts"
  23. <form method="get" action="file_iframe_sandbox_form_fail.html" id="a_form">
  24. First name: <input type="text" name="firstname">
  25. Last name: <input type="text" name="lastname">
  26. <input type="submit" onclick="doSubmit()" id="a_button">
  27. </form>
  28. <a href = 'javascript:ok(true, "documents sandboxed with allow-scripts should be able to run script from javascript: URLs");' id='a_link'>click me</a>
  29. </body>
  30. </html>