|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=527935 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 527935</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=527935">Mozilla Bug 527935</a> |
|
14 <p id="display"></p> |
|
15 <div id="content"> |
|
16 <iframe id="formTarget" name="formTarget"></iframe> |
|
17 <form action="data:text/html," target="formTarget"> |
|
18 <input name="test" id="initValue"><input type="submit"> |
|
19 </form> |
|
20 </div> |
|
21 <pre id="test"> |
|
22 <script type="application/javascript"> |
|
23 |
|
24 /** Test for Bug 527935 **/ |
|
25 SimpleTest.waitForExplicitFinish(); |
|
26 SimpleTest.waitForFocus(function() { |
|
27 var formTarget = document.getElementById("formTarget"); |
|
28 var initValue = document.getElementById("initValue"); |
|
29 |
|
30 formTarget.addEventListener("load", function() { |
|
31 var newInput = document.createElement("input"); |
|
32 newInput.setAttribute("name", "test"); |
|
33 document.body.appendChild(newInput); |
|
34 |
|
35 setTimeout(function() { |
|
36 var popupShown = false; |
|
37 function listener() { |
|
38 popupShown = true; |
|
39 } |
|
40 SpecialPowers.addAutoCompletePopupEventListener(window, "popupshowing", listener); |
|
41 |
|
42 var event = document.createEvent("KeyboardEvent"); |
|
43 |
|
44 event.initKeyEvent("keypress", true, true, null, false, false, |
|
45 false, false, 0, "f".charCodeAt(0)); |
|
46 newInput.value = ""; |
|
47 newInput.focus(); |
|
48 newInput.dispatchEvent(event); |
|
49 |
|
50 hitEventLoop(function() { |
|
51 ok(!popupShown, "Popup must not be opened"); |
|
52 SpecialPowers.removeAutoCompletePopupEventListener(window, "popupshowing", listener); |
|
53 SimpleTest.finish(); |
|
54 }, 100); |
|
55 }, 0); |
|
56 }, false); |
|
57 |
|
58 initValue.focus(); |
|
59 initValue.value = "foo"; |
|
60 synthesizeKey("VK_RETURN", {}); |
|
61 }); |
|
62 |
|
63 function hitEventLoop(func, times) { |
|
64 if (times > 0) { |
|
65 setTimeout(hitEventLoop, 0, func, times - 1); |
|
66 } else { |
|
67 setTimeout(func, 0); |
|
68 } |
|
69 } |
|
70 |
|
71 </script> |
|
72 </pre> |
|
73 </body> |
|
74 </html> |