toolkit/content/tests/chrome/test_popup_recreate.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"?>
     5 <window title="Popup Recreate Test"
     6   onload="setTimeout(init, 0)"
     7   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 <!--
    13   This is a test for bug 388361.
    15   This test checks that a menulist's popup is properly created and sized when
    16   the popup node is removed and another added in its place.
    18   -->
    20 <script>
    21 <![CDATA[
    22 SimpleTest.waitForExplicitFinish();
    24 var gState = "before";
    26 function init()
    27 {
    28   document.getElementById("menulist").open = true;
    29 }
    31 function recreate()
    32 {
    33   if (gState == "before") {
    34     var element = document.getElementById("menulist");
    35     while (element.hasChildNodes())
    36       element.removeChild(element.firstChild);
    37     element.appendItem("Cat");
    38     gState = "after";
    39     document.getElementById("menulist").open = true;
    40   }
    41   else {
    42     SimpleTest.finish();
    43   }
    44 }
    46 function checkSize()
    47 {
    48   var menulist = document.getElementById("menulist");
    49   var menurect = menulist.getBoundingClientRect();
    50   var popuprect = menulist.menupopup.getBoundingClientRect();
    52   ok(Math.round(menurect.left) == Math.round(popuprect.left) &&
    53      Math.round(menurect.right) == Math.round(popuprect.right) &&
    54      Math.round(popuprect.right) - Math.round(popuprect.left) > 0,
    55      "height " + gState)
    56   document.getElementById("menulist").open = false;
    57 }
    58 ]]>
    59 </script>
    61 <hbox>
    62   <menulist id="menulist" onpopupshown="checkSize();" onpopuphidden="recreate();">
    63     <menupopup>
    64       <menuitem label="Cat"/>
    65     </menupopup>
    66   </menulist>
    67 </hbox>
    69 <body xmlns="http://www.w3.org/1999/xhtml">
    70 <p id="display">
    71 </p>
    72 <div id="content" style="display: none">
    73 </div>
    74 <pre id="test">
    75 </pre>
    76 </body>
    78 </window>

mercurial