https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c4742caa9ad8c4b4a00ded7c4dac2a1e1563cb4b authored by L. David Baron on 02 April 2018, 19:01:11 UTC
Sync Mozilla tests as of https://hg.mozilla.org/mozilla-central/rev/c44f60c43432d468639b5fe078420e60c13fd3de .
Tip revision: c4742ca
form-action-src-allowed-target-frame.sub.html
<!DOCTYPE html>
<html>
<head>
  <title>form-action-src-allowed-target-frame</title>
  <meta http-equiv="Content-Security-Policy" content="form-action 'self'">
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script>
    function OnDocumentLoaded() {
      let test = async_test("form submission targetting a frame allowed");
      window.addEventListener("message", function(event) {
        if (event.data == "DocumentNotBlocked") {
          test.done();
        }
      });

      let form = document.getElementById("form");
      form.action =
        "/content-security-policy/form-action/support/post-message-to-parent.sub.html";

      let submit = document.getElementById("submit");
      submit.click();
    }
  </script>
</head>
<body onload="OnDocumentLoaded();">
  <form id="form" method="GET" target="frame">
    <input type="hidden" name="message" value="DocumentNotBlocked">
    <input type="submit" id="submit">
  </form>
  <iframe name="frame"></iframe>
</body>
</html>

back to top