toolkit/content/tests/chrome/test_bug557987.xul

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 <?xml version="1.0"?>
     2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     4 <!--
     5   XUL Widget Test for bug 557987
     6   -->
     7 <window title="Bug 557987" width="400" height="400"
     8         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
     9   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>  
    10   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    12   <toolbarbutton id="button" type="menu-button" label="Test bug 557987"
    13                                                onclick="eventReceived('click');"
    14                                                oncommand="eventReceived('command');">
    15     <menupopup onpopupshowing="eventReceived('popupshowing'); return false;" />
    16   </toolbarbutton>
    17   <menulist id="menulist" editable="true" value="Test bug 557987" 
    18                                           onfocus="eventReceived('focus')" />
    19   <!-- test results are displayed in the html:body -->
    20   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    22 <script type="application/javascript">
    23 <![CDATA[
    25 SimpleTest.waitForExplicitFinish();
    27 SimpleTest.waitForFocus(test);
    29 // Tests that mouse events are correctly dispatched to <toolbarbutton type="menu-button"/>
    30 function test() {
    32   disableNonTestMouseEvents(true);
    34   let button = $("button");
    35   let rightEdge = button.getBoundingClientRect().width - 2;
    36   let centerX   = button.getBoundingClientRect().width / 2;
    37   let centerY   = button.getBoundingClientRect().height / 2;
    39   synthesizeMouse(button, rightEdge, centerY, {}, window);
    40   synthesizeMouse(button, centerX, centerY, {}, window);
    42   let menulist = $("menulist");
    43   let centerX = menulist.getBoundingClientRect().width / 2;
    44   let centerY = menulist.getBoundingClientRect().height / 2;
    45   synthesizeMouse(menulist, centerX, centerY, {}, window);
    47   synthesizeMouse(document.getElementsByTagName("body")[0], 0, 0, {}, window);
    49   disableNonTestMouseEvents(false);
    50   SimpleTest.executeSoon(finishTest);
    52 }
    54 function finishTest() {
    55   is(eventCount.command, 1, "Correct number of command events received");
    56   is(eventCount.popupshowing, 1, "Correct number of popupshowing events received");
    57   is(eventCount.click, 2, "Correct number of click events received");
    58   is(eventCount.focus, 1, "Correct number of focus events received");
    60   SimpleTest.finish();
    61 }
    63 let eventCount = {
    64   command: 0,
    65   popupshowing: 0,
    66   click: 0,
    67   focus: 0
    68 };
    70 function eventReceived(eventName) {
    71   eventCount[eventName]++;
    72 }
    74 ]]>
    75 </script>
    76 </window>

mercurial