editor/libeditor/text/tests/test_bug527935.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.

     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">
    24 /** Test for Bug 527935 **/
    25 SimpleTest.waitForExplicitFinish();
    26 SimpleTest.waitForFocus(function() {
    27   var formTarget = document.getElementById("formTarget");
    28   var initValue = document.getElementById("initValue");
    30   formTarget.addEventListener("load", function() {
    31     var newInput = document.createElement("input");
    32     newInput.setAttribute("name", "test");
    33     document.body.appendChild(newInput);
    35     setTimeout(function() {
    36       var popupShown = false;
    37       function listener() {
    38         popupShown = true;
    39       }
    40       SpecialPowers.addAutoCompletePopupEventListener(window, "popupshowing", listener);
    42       var event = document.createEvent("KeyboardEvent");
    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);
    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);
    58   initValue.focus();
    59   initValue.value = "foo";
    60   synthesizeKey("VK_RETURN", {});
    61 });
    63 function hitEventLoop(func, times) {
    64   if (times > 0) {
    65     setTimeout(hitEventLoop, 0, func, times - 1);
    66   } else {
    67     setTimeout(func, 0);
    68   }
    69 }
    71 </script>
    72 </pre>
    73 </body>
    74 </html>

mercurial