dom/events/test/test_bug402089.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=402089
     5 -->
     6 <head>
     7   <title>Test for Bug 402089</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 <!-- setTimeout so that the test starts after paint suppression ends -->
    13 <body onload="setTimeout(doTest,0);">
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=402089">Mozilla Bug 402089</a>
    15 <p id="display"></p>
    16 <div id="content">
    17   <pre id="result1"></pre>
    18   <pre id="result2"></pre>
    19 </div>
    20 <pre id="test">
    21 <script class="testbody" type="text/javascript">
    23 /** Test for Bug 402089 **/
    25 var cachedEvent = null;
    27 function testCachedEvent() {
    28   testEvent('result2');
    29   ok((document.getElementById('result1').textContent ==
    30       document.getElementById('result2').textContent),
    31       "Event coordinates should be the same after dispatching.");
    32   SimpleTest.finish();
    33 }
    35 function testEvent(res) {
    36   var s = cachedEvent.type + "\n";
    37   s += "clientX: " + cachedEvent.clientX + ", clientY: " + cachedEvent.clientY + "\n";
    38   s += "screenX: " + cachedEvent.screenX + ", screenY: " + cachedEvent.screenY + "\n";
    39   s += "layerX: " + cachedEvent.layerX + ", layerY: " + cachedEvent.layerY + "\n";
    40   s += "pageX: " + cachedEvent.pageX + ", pageY: " + cachedEvent.pageY + "\n";
    41   document.getElementById(res).textContent += s;
    42 }
    44 function clickHandler(e) {
    45   cachedEvent = e;
    46   testEvent('result1');
    47   e.stopPropagation();
    48   e.preventDefault();
    49   window.removeEventListener("click", clickHandler, true);
    50   setTimeout(testCachedEvent, 10);
    51 }
    53 function doTest() {
    54   window.addEventListener("click", clickHandler, true);
    55   var utils = SpecialPowers.getDOMWindowUtils(window);
    56   utils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
    57   utils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
    59 }
    61 SimpleTest.waitForExplicitFinish();
    62 </script>
    63 </pre>
    64 </body>
    65 </html>

mercurial