editor/libeditor/html/tests/test_bug417418.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=417418
     5 -->
     6 <head>
     7   <title>Test for Bug 417418</title>
     8   <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417418">Mozilla Bug 417418</a>
    15 <div id="display" contenteditable="true">
    16 <p id="coin">first paragraph</p>
    17 <p>second paragraph. <img id="img" src="green.png"></p>
    18 </div>
    19 <div id="content" style="display: none">
    21 </div>
    22 <pre id="test">
    23 <script class="testbody" type="text/javascript">
    25 /** Test for Bug 417418 **/
    26 SimpleTest.waitForExplicitFinish();
    27 SimpleTest.waitForFocus(runTest);
    29 function resetSelection() {
    30   window.getSelection().collapse(document.getElementById("coin"), 0);
    31 }
    33 function runTest() {
    34     var rightClick = {type: 'mousedown', button: 2},
    35         singleClick = {type: 'mousedown', button: 0};
    36     var selection = window.getSelection();
    38     var div = document.getElementById('display');
    39     var img = document.getElementById('img');
    40     var divRect = div.getBoundingClientRect();
    41     var imgselected;
    43     resetSelection();
    44     synthesizeMouse(div, divRect.width - 1, divRect.height - 1, rightClick);
    45     ok(selection.isCollapsed, "selection is not collapsed");
    47     resetSelection();
    48     synthesizeMouse(div, divRect.width - 1, divRect.height - 1, singleClick);
    49     ok(selection.isCollapsed, "selection is not collapsed");
    51     resetSelection();
    52     synthesizeMouseAtCenter(img, rightClick);
    53     imgselected = selection.anchorNode == img.parentNode &&
    54                       selection.anchorOffset === 1 &&
    55                       selection.rangeCount === 1;
    56     ok(imgselected, "image is not selected");
    58     resetSelection();
    59     synthesizeMouseAtCenter(img, singleClick);
    60     imgselected = selection.anchorNode == img.parentNode &&
    61                       selection.anchorOffset === 1 &&
    62                       selection.rangeCount === 1;
    63     ok(imgselected, "image is not selected");
    65     SimpleTest.finish();
    66 }
    69 </script>
    70 </pre>
    71 </body>
    72 </html>

mercurial