diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-3.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-3.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-3.html b/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-3.html new file mode 100644 index 0000000000..fbb6a42577 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/form-submission-0/form-double-submit-3.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel="author" href="mailto:masonf@chromium.org"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-submission-algorithm"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<!-- <button> should have the same double-submit protection that + <input type=submit> has. + --> + + + + +<label for=frame1 style="display:block">This frame should stay blank</label> +<iframe name=frame1 id=frame1></iframe> +<label for=frame2 style="display:block">This frame should navigate (to 404)</label> +<iframe name=frame2 id=frame2></iframe> +<form id="form1" target="frame1" action="nonexistent.html"> + <input type=hidden name=navigated value=1> + <button id=submitbutton>submit</button> +</form> + +<script> +let frame1 = document.getElementById('frame1'); +let frame2 = document.getElementById('frame2'); +let form1 = document.getElementById('form1'); +let submitbutton = document.getElementById('submitbutton'); + +async_test(t => { + window.addEventListener('load', () => { + frame1.addEventListener('load', t.step_func_done(() => { + assert_unreached("Frame1 should not get navigated by this test."); + })); + frame2.addEventListener('load', t.step_func_done(() => { + let params = (new URL(frame2.contentWindow.location)).searchParams; + let wasNavigated = !!params.get("navigated"); + assert_true(wasNavigated) + })); + form1.addEventListener('click', t.step_func(() => { + form1.submit(); + form1.target='frame2'; + + })); + submitbutton.click(); + }); +}, '<button> should have the same double-submit protection as <input type=submit>'); + +</script> |