Sat, 03 Jan 2015 20:18:00 +0100
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 positioning
6 -->
7 <window title="position" width="500" height="600"
8 onload="setTimeout(runTest, 0);"
9 style="margin: 0; border: 0; padding; 0;"
10 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
15 <hbox id="box1">
16 <button label="0" width="100" height="40" style="margin: 3px;"/>
17 </hbox>
18 <scrollbox id="box2" orient="vertical" align="start" width="200" height="50"
19 style="overflow: hidden; margin-left: 2px; padding: 1px;">
20 <deck>
21 <scrollbox id="box3" orient="vertical" align="start" height="100"
22 style="overflow: scroll; margin: 1px; padding: 0;">
23 <vbox id="innerscroll" width="200" align="start">
24 <button id="button1" label="1" width="90" maxwidth="100"
25 minheight="25" height="35" maxheight="50"
26 style="min-width: 80px; margin: 5px; border: 4px; padding: 7px;
27 -moz-appearance: none;"/>
28 <menu id="menu">
29 <menupopup id="popup" style="-moz-appearance: none; margin:0; border: 0; padding: 0;"
30 onpopupshown="menuOpened()"
31 onpopuphidden="if (event.target == this) SimpleTest.finish()">
32 <menuitem label="One"/>
33 <menu id="submenu" label="Three">
34 <menupopup id="subpopup" style="-moz-appearance: none; margin:0; border: 0; padding: 0;"
35 onpopupshown="submenuOpened()">
36 <menuitem label="Four"/>
37 </menupopup>
38 </menu>
39 </menupopup>
40 </menu>
41 <button label="2" maxwidth="100" maxheight="20" style="margin: 5px;"/>
42 <button label="3" maxwidth="100" maxheight="20" style="margin: 5px;"/>
43 <button label="4" maxwidth="100" maxheight="20" style="margin: 5px;"/>
44 </vbox>
45 <box height="200"/>
46 </scrollbox>
47 </deck>
48 </scrollbox>
50 <body xmlns="http://www.w3.org/1999/xhtml">
51 <p id="display"></p>
52 <div id="content" style="display: none">
53 </div>
54 <pre id="test">
55 </pre>
56 </body>
58 <script>
59 <![CDATA[
61 SimpleTest.waitForExplicitFinish();
63 function runTest()
64 {
65 var winwidth = document.documentElement.boxObject.width;
66 var innerscroll = $("innerscroll").boxObject.width;
68 var box1 = $("box1");
69 checkPosition("box1", box1, 0, 0, winwidth, 46);
71 var box2 = $("box2");
72 checkPosition("box2", box2, 2, 46, winwidth, 96);
74 // height is height(box1) = 46 + margin-top(box3) = 1 + margin-top(button1) = 5
75 var button1 = $("button1");
76 checkPosition("button1", button1, 9, 53, 99, 88);
78 var sbo = box2.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
79 sbo.scrollTo(7, 16);
81 // clientRect height is offset from root so is 16 pixels vertically less
82 checkPosition("button1 scrolled", button1, 9, 37, 99, 72);
84 var box3 = $("box3");
85 sbo = box3.boxObject.QueryInterface(Components.interfaces.nsIScrollBoxObject);
86 sbo.scrollTo(1, 2);
88 checkPosition("button1 scrolled", button1, 9, 35, 99, 70);
90 $("menu").open = true;
91 }
93 function menuOpened()
94 {
95 $("submenu").open = true;
96 }
98 function submenuOpened()
99 {
100 var menu = $("menu");
101 var menuleft = Math.round(menu.getBoundingClientRect().left);
102 var menubottom = Math.round(menu.getBoundingClientRect().bottom);
104 var submenu = $("submenu");
105 var submenutop = Math.round(submenu.getBoundingClientRect().top);
106 var submenuright = Math.round(submenu.getBoundingClientRect().right);
108 checkPosition("popup", $("popup"), menuleft, menubottom, -1, -1);
109 checkPosition("subpopup", $("subpopup"), submenuright, submenutop, -1, -1);
111 menu.open = false;
112 }
114 function checkPosition(testid, elem, cleft, ctop, cright, cbottom)
115 {
116 // -1 for right or bottom means that the exact size should not be
117 // checked, just ensure it is larger then the left or top position
118 var rect = elem.getBoundingClientRect();
119 is(Math.round(rect.left), cleft, testid + " client rect left");
120 if (testid != "popup")
121 is(Math.round(rect.top), ctop, testid + " client rect top");
122 if (cright >= 0)
123 is(Math.round(rect.right), cright, testid + " client rect right");
124 else
125 ok(rect.right - rect.left > 20, testid + " client rect right");
126 if (cbottom >= 0)
127 is(Math.round(rect.bottom), cbottom, testid + " client rect bottom");
128 else
129 ok(rect.bottom - rect.top > 15, testid + " client rect bottom");
130 }
132 ]]>
134 </script>
136 </window>