diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html b/testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html new file mode 100644 index 0000000000..baee5500de --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-form-element/form-action-submission-with-base-url.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>form action="" attribute effect on submission</title> +<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<body> +<script> +"use strict"; + +// promise_test instead of async_test because all tests use window.success, and so can't run at the same time. + +promise_test(t => { + return new Promise(resolve => { + window.success = t.step_func(locationLoaded => { + const expected = (new URL("resources/target/form-action-url-target.html?name=value", location.href)).href; + assert_equals(locationLoaded, expected); + resolve(); + }); + + const iframe = document.createElement("iframe"); + iframe.src = "resources/form-with-action-and-base.sub.html?action=form-action-url-target.html"; + document.body.appendChild(iframe); + }); +}, "An action URL should be resolved relative to the document's base URL (not document URL)"); + +promise_test(t => { + return new Promise(resolve => { + window.success = t.step_func(locationLoaded => { + const expected = (new URL("resources/form-with-action-and-base.sub.html?name=value", location.href)).href; + assert_equals(locationLoaded, expected); + resolve(); + }); + + const iframe = document.createElement("iframe"); + iframe.src = "resources/form-with-action-and-base.sub.html?action="; + document.body.appendChild(iframe); + }); +}, "An empty-string action should submit the form to its containing document's URL (not its base URL)"); + +promise_test(t => { + return new Promise(resolve => { + window.success = t.step_func(locationLoaded => { + const expected = (new URL("resources/form-no-action-with-base.html?name=value", location.href)).href; + assert_equals(locationLoaded, expected); + resolve(); + }); + + const iframe = document.createElement("iframe"); + iframe.src = "resources/form-no-action-with-base.html"; + document.body.appendChild(iframe); + }); +}, "A missing action should submit the form to its containing document's URL (not its base URL)"); +</script> |