editor/libeditor/text/tests/test_bug527935.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial