summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_bug561636.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/html/test/test_bug561636.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/html/test/test_bug561636.html')
-rw-r--r--dom/html/test/test_bug561636.html99
1 files changed, 99 insertions, 0 deletions
diff --git a/dom/html/test/test_bug561636.html b/dom/html/test/test_bug561636.html
new file mode 100644
index 0000000000..da51b07607
--- /dev/null
+++ b/dom/html/test/test_bug561636.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=561636
+-->
+<head>
+ <title>Test for Bug 561636</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=561636">Mozilla Bug 561636</a>
+<p id="display"></p>
+<iframe style='width:50px; height: 50px;' name='t'></iframe>
+<iframe style='width:50px; height: 50px;' name='t2' id='i'></iframe>
+<div id="content">
+ <form target='t' action='data:text/html,'>
+ <input required>
+ <input id='a' type='submit'>
+ </form>
+ <form target='t' action='data:text/html,'>
+ <input type='checkbox' required>
+ <button id='b' type='submit'></button>
+ </form>
+ <form target='t' action='data:text/html,'>
+ <input id='c' required>
+ </form>
+ <form target='t' action='data:text/html,'>
+ <input>
+ <input id='s2' type='submit'>
+ </form>
+ <form target='t2' action='data:text/html,'>
+ <input required>
+ </form>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 561636 **/
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(runTest);
+
+function runTest()
+{
+ var formSubmitted = [ false, false ];
+ var invalidHandled = false;
+
+ // Initialize
+ document.forms[0].addEventListener('submit', function(aEvent) {
+ formSubmitted[0] = true;
+ }, {once: true});
+
+ document.forms[1].addEventListener('submit', function(aEvent) {
+ formSubmitted[1] = true;
+ }, {once: true});
+
+ document.forms[2].addEventListener('submit', function(aEvent) {
+ formSubmitted[2] = true;
+ }, {once: true});
+
+ document.forms[3].addEventListener('submit', function(aEvent) {
+ formSubmitted[3] = true;
+
+ ok(!formSubmitted[0], "Form 1 should not have been submitted because invalid");
+ ok(!formSubmitted[1], "Form 2 should not have been submitted because invalid");
+ ok(!formSubmitted[2], "Form 3 should not have been submitted because invalid");
+ ok(formSubmitted[3], "Form 4 should have been submitted because valid");
+
+ // Next test.
+ document.forms[4].submit();
+ }, {once: true});
+
+ document.forms[4].elements[0].addEventListener('invalid', function(aEvent) {
+ invalidHandled = true;
+ }, {once: true});
+
+ document.getElementById('i').addEventListener('load', function(aEvent) {
+ SimpleTest.executeSoon(function () {
+ ok(true, "Form 5 should have been submitted because submit() has been used even if invalid");
+ ok(!invalidHandled, "Invalid event should not have been sent");
+
+ SimpleTest.finish();
+ });
+ }, {once: true});
+
+ document.getElementById('a').click();
+ document.getElementById('b').click();
+ var c = document.getElementById('c');
+ c.focus();
+ synthesizeKey("KEY_Enter");
+ document.getElementById('s2').click();
+}
+
+</script>
+</pre>
+</body>
+</html>