toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>autocomplete with composition tests on HTML input element</title>
michael@0 5 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
michael@0 7 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
michael@0 8 <script type="text/javascript" src="file_autocomplete_with_composition.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <p id="display"></p>
michael@0 13
michael@0 14 <div id="content">
michael@0 15 <iframe id="formTarget" name="formTarget"></iframe>
michael@0 16 <form action="data:text/html," target="formTarget">
michael@0 17 <input name="test" id="input"><input type="submit">
michael@0 18 </form>
michael@0 19 </div>
michael@0 20
michael@0 21 <pre id="test">
michael@0 22 <script class="testbody" type="text/javascript">
michael@0 23
michael@0 24 SimpleTest.waitForExplicitFinish();
michael@0 25
michael@0 26 function runTests()
michael@0 27 {
michael@0 28 var formFillController =
michael@0 29 SpecialPowers.getFormFillController()
michael@0 30 .QueryInterface(Components.interfaces.nsIAutoCompleteInput);
michael@0 31 var originalFormFillTimeout = formFillController.timeout;
michael@0 32
michael@0 33 SpecialPowers.attachFormFillControllerTo(window);
michael@0 34 var target = document.getElementById("input");
michael@0 35
michael@0 36 // Register a word to the form history.
michael@0 37 target.focus();
michael@0 38 target.value = "Mozilla";
michael@0 39 synthesizeKey("VK_RETURN", {});
michael@0 40 target.value = "";
michael@0 41
michael@0 42 var test1 = new nsDoTestsForAutoCompleteWithComposition(
michael@0 43 "Testing on HTML input (asynchronously search)",
michael@0 44 window, target, formFillController.controller, is,
michael@0 45 function () { return target.value; },
michael@0 46 function () {
michael@0 47 target.setAttribute("timeout", 0);
michael@0 48 var test2 = new nsDoTestsForAutoCompleteWithComposition(
michael@0 49 "Testing on HTML input (synchronously search)",
michael@0 50 window, target, formFillController.controller, is,
michael@0 51 function () { return target.value; },
michael@0 52 function () {
michael@0 53 formFillController.timeout = originalFormFillTimeout;
michael@0 54 SpecialPowers.detachFormFillControllerFrom(window);
michael@0 55 SimpleTest.finish();
michael@0 56 });
michael@0 57 });
michael@0 58 }
michael@0 59
michael@0 60 SimpleTest.waitForFocus(runTests);
michael@0 61
michael@0 62 </script>
michael@0 63 </pre>
michael@0 64 </body>
michael@0 65 </html>

mercurial