summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/form-submission-target/form-target-request-header.html
blob: a5cd68078d07c49fc1f3a5ff296b359ab6985226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<title>Form request header test</title>
<script src="/common/utils.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
  window.addEventListener("load", function() {
    let form = document.createElement("form");
    form.action = "resources/form-target-request-header-helper.py";
    form.method = "post";
    form.target = "_blank";

    const channelName = token();
    const channel = new BroadcastChannel(channelName);
    channel.onmessage = t.step_func_done(e => {
      assert_equals(e.data, "OK");
    });

    let url_input = document.createElement("input");
    url_input.type = "hidden";
    url_input.name = "channelname";
    url_input.value = channelName;

    form.appendChild(url_input);
    document.body.appendChild(form);
    form.submit();
  });
}, 'Verify the content-type exist during a form submission toward "_blank"');
</script>
<body>