editor/libeditor/html/tests/test_bug966155.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=966155
     5 -->
     6 <head>
     7   <title>Test for Bug 966155</title>
     8   <script type="text/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=966155">Mozilla Bug 966155</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    19 SimpleTest.waitForExplicitFinish();
    21 addLoadEvent(function() {
    22   var win = window.open("data:text/html,<input><iframe onload=\"contentDocument.designMode = 'on';\">", "", "test-966155");
    23   win.addEventListener("load", function onLoad() {
    24     win.removeEventListener("load", onLoad);
    25     runTest(win);
    26   }, false);
    27 });
    29 function runTest(win) {
    30   SimpleTest.waitForFocus(function() {
    31     var doc = win.document;
    32     var iframe = doc.querySelector("iframe");
    33     var iframeDoc = iframe.contentDocument;
    34     var input = doc.querySelector("input");
    35     iframe.focus();
    36     iframeDoc.body.focus();
    37     // Type some text
    38     "test".split("").forEach(function(letter) {
    39       synthesizeKey(letter, {}, win);
    40     });
    41     is(iframeDoc.body.textContent, "test", "entered the text");
    42     // focus the input box
    43     input.focus();
    44     // press tab
    45     synthesizeKey("VK_TAB", {}, win);
    46     // Now press Ctrl+Backspace
    47     synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win);
    48     is(iframeDoc.body.textContent, "", "deleted the text");
    49     win.close();
    50     SimpleTest.finish();
    51   }, win);
    52 }
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial