summaryrefslogtreecommitdiffstats
path: root/layout/forms/test/test_bug411236.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /layout/forms/test/test_bug411236.html
parentInitial commit. (diff)
downloadfirefox-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 'layout/forms/test/test_bug411236.html')
-rw-r--r--layout/forms/test/test_bug411236.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/layout/forms/test/test_bug411236.html b/layout/forms/test/test_bug411236.html
new file mode 100644
index 0000000000..b2e2bee380
--- /dev/null
+++ b/layout/forms/test/test_bug411236.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=411236
+-->
+<head>
+ <title>Test for Bug 411236</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=411236">Mozilla Bug 411236</a>
+<p id="display"></p>
+<div id="content">
+ <input type="file" onfocus="window.oTarget = event.originalTarget;"
+ onclick="window.fileInputGotClick = true; return false;"
+ id="fileinput">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 411236 **/
+
+window.oTarget = null;
+window.fileInputGotClick = false;
+
+function test() {
+ // Try to find the '<input>' using tabbing.
+ var i = 0;
+ while (!window.oTarget && i < 100) {
+ ++i;
+ synthesizeKey("KEY_Tab");
+ }
+
+ if (i >= 100) {
+ ok(false, "Couldn't find an input element!");
+ SimpleTest.finish();
+ return;
+ }
+
+ ok(window.oTarget instanceof HTMLInputElement, "Should have focused the input element!");
+ var e = document.createEvent("mouseevents");
+ e.initMouseEvent("click", true, true, window, 0, 1, 1, 1, 1,
+ false, false, false, false, 0, null);
+ SpecialPowers.wrap(window.oTarget).dispatchEvent(e);
+ ok(window.fileInputGotClick,
+ "File input should have got a click event, but not open the file dialog.");
+ SimpleTest.finish();
+}
+
+function beginTest() {
+ // accessibility.tabfocus must be set to value 7 before running test also
+ // on a mac.
+ SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}, do_test);
+}
+
+function do_test() {
+ window.focus();
+ document.getElementById('fileinput').focus();
+ setTimeout(test, 100);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+addLoadEvent(beginTest);
+
+</script>
+</pre>
+</body>
+</html>