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.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
michael@0 4
michael@0 5 <window title="Popup Recreate Test"
michael@0 6 onload="setTimeout(init, 0)"
michael@0 7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 8
michael@0 9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
michael@0 11
michael@0 12 <!--
michael@0 13 This is a test for bug 388361.
michael@0 14
michael@0 15 This test checks that a menulist's popup is properly created and sized when
michael@0 16 the popup node is removed and another added in its place.
michael@0 17
michael@0 18 -->
michael@0 19
michael@0 20 <script>
michael@0 21 <![CDATA[
michael@0 22 SimpleTest.waitForExplicitFinish();
michael@0 23
michael@0 24 var gState = "before";
michael@0 25
michael@0 26 function init()
michael@0 27 {
michael@0 28 document.getElementById("menulist").open = true;
michael@0 29 }
michael@0 30
michael@0 31 function recreate()
michael@0 32 {
michael@0 33 if (gState == "before") {
michael@0 34 var element = document.getElementById("menulist");
michael@0 35 while (element.hasChildNodes())
michael@0 36 element.removeChild(element.firstChild);
michael@0 37 element.appendItem("Cat");
michael@0 38 gState = "after";
michael@0 39 document.getElementById("menulist").open = true;
michael@0 40 }
michael@0 41 else {
michael@0 42 SimpleTest.finish();
michael@0 43 }
michael@0 44 }
michael@0 45
michael@0 46 function checkSize()
michael@0 47 {
michael@0 48 var menulist = document.getElementById("menulist");
michael@0 49 var menurect = menulist.getBoundingClientRect();
michael@0 50 var popuprect = menulist.menupopup.getBoundingClientRect();
michael@0 51
michael@0 52 ok(Math.round(menurect.left) == Math.round(popuprect.left) &&
michael@0 53 Math.round(menurect.right) == Math.round(popuprect.right) &&
michael@0 54 Math.round(popuprect.right) - Math.round(popuprect.left) > 0,
michael@0 55 "height " + gState)
michael@0 56 document.getElementById("menulist").open = false;
michael@0 57 }
michael@0 58 ]]>
michael@0 59 </script>
michael@0 60
michael@0 61 <hbox>
michael@0 62 <menulist id="menulist" onpopupshown="checkSize();" onpopuphidden="recreate();">
michael@0 63 <menupopup>
michael@0 64 <menuitem label="Cat"/>
michael@0 65 </menupopup>
michael@0 66 </menulist>
michael@0 67 </hbox>
michael@0 68
michael@0 69 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 70 <p id="display">
michael@0 71 </p>
michael@0 72 <div id="content" style="display: none">
michael@0 73 </div>
michael@0 74 <pre id="test">
michael@0 75 </pre>
michael@0 76 </body>
michael@0 77
michael@0 78 </window>

mercurial