dom/events/test/test_bug443985.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=443985
     5 -->
     6 <head>
     7   <title>Test for Bug 443985</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=443985">Mozilla Bug 443985</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 /** Test for Bug 443985 **/
    23 function listenerForNoScroll(evt) {
    24   is(evt.clientX, evt.pageX, "Wrong .pageX");
    25   is(evt.clientY, evt.pageY, "Wrong .pageY");
    26   is(evt.screenX, 0, "Wrong .screenX");
    27   is(evt.screenY, 0, "Wrong .screenY");
    28   is(evt.clientX, 10, "Wrong .clientX");
    29   is(evt.clientY, 10, "Wrong .clientY");
    30 }
    32 function listenerForScroll(evt) {
    33   isnot(evt.clientX, evt.pageX, "Wrong .pageX");
    34   isnot(evt.clientY, evt.pageY, "Wrong .pageY");
    35   ok(evt.pageX > 3000, "Wrong .pageX");
    36   ok(evt.pageY > 3000, "Wrong .pageY");
    37   is(evt.screenX, 0, "Wrong .screenX");
    38   is(evt.screenY, 0, "Wrong .screenY");
    39   is(evt.clientX, 10, "Wrong .clientX");
    40   is(evt.clientY, 10, "Wrong .clientY");
    41 }
    43 function doTest() {
    44   window.scrollTo(0, 0);
    45   var target = document.getElementById("testTarget");
    46   target.addEventListener("click", listenerForNoScroll, true);
    47   var me = document.createEvent("MouseEvent");
    48   me.initMouseEvent("click", true, true, window, 0, 0, 0, 10, 10, 
    49                     false, false, false, false, 0, null);
    50   target.dispatchEvent(me);
    51   target.removeEventListener("click", listenerForNoScroll, true);
    53   target.scrollIntoView(true);
    54   target.addEventListener("click", listenerForScroll, true);
    55   me = document.createEvent("MouseEvent");
    56   me.initMouseEvent("click", true, true, window, 0, 0, 0, 10, 10, 
    57                     false, false, false, false, 0, null);
    58   target.dispatchEvent(me);
    59   target.addEventListener("click", listenerForNoScroll, true);
    61   document.getElementsByTagName("a")[0].scrollIntoView(true);
    62   SimpleTest.finish();
    63 }
    65 SimpleTest.waitForExplicitFinish();
    66 addLoadEvent(doTest);
    68 </script>
    69 </pre>
    70 <div style="min-height: 4000px; min-width: 4000px;"></div>
    71 <div style="min-width: 4000px; text-align: right;">
    72   <span id="testTarget" style="border: 1px solid black;">testTarget</span>
    73 </div>
    74 </body>
    75 </html>

mercurial