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 bug 562554
6 -->
7 <window title="Bug 562554" width="400" height="400"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
9 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
13 <xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl">
14 <xbl:binding id="menu" display="xul:menu"
15 extends="chrome://global/content/bindings/button.xml#button-base">
16 <xbl:content>
17 <xbl:children includes="menupopup"/>
18 <xul:stack>
19 <xul:button width="100" left="0" top="0" height="30" allowevents="true"
20 onclick="eventReceived('clickbutton1'); return false;"/>
21 <xul:button width="100" left="70" top="0" height="30"
22 onclick="eventReceived('clickbutton2'); return false;"/>
23 </xul:stack>
24 </xbl:content>
25 </xbl:binding>
26 </xbl:bindings>
28 <toolbarbutton type="menu" id="toolbarmenu" height="200" style="-moz-binding: url(#menu);">
29 <menupopup id="menupopup" onpopupshowing="eventReceived('popupshowing'); return false;"/>
30 </toolbarbutton>
32 <!-- test results are displayed in the html:body -->
33 <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
35 <script type="application/javascript">
36 <![CDATA[
38 SimpleTest.waitForExplicitFinish();
39 SimpleTest.waitForFocus(test);
41 // Tests that mouse events are correctly dispatched to <toolbarbutton type="menu"/>
42 function test() {
43 disableNonTestMouseEvents(true);
44 nextTest();
45 }
47 let tests = [
48 // Click on the toolbarbutton itself - should call popupshowing
49 function() synthesizeMouse($("toolbarmenu"), 10, 50, {}, window),
51 // Click on button1 which has allowevents="true" - should call clickbutton1
52 function() synthesizeMouse($("toolbarmenu"), 10, 15, {}, window),
54 // Click on button2 where it intersects with button1 - should call popupshowing
55 function() synthesizeMouse($("toolbarmenu"), 85, 15, {}, window),
57 // Click on button2 outside of intersection - should call popupshowing
58 function() synthesizeMouse($("toolbarmenu"), 150, 15, {}, window)
59 ];
61 function nextTest() {
62 if (tests.length) {
63 let func = tests.shift();
64 func();
65 SimpleTest.executeSoon(nextTest);
66 } else {
67 disableNonTestMouseEvents(false);
68 SimpleTest.executeSoon(finishTest);
69 }
70 }
72 function finishTest() {
73 is(eventCount.clickbutton1, 1, "Correct number of clicks on button 1");
74 is(eventCount.clickbutton2, 0, "Correct number of clicks on button 2");
75 is(eventCount.popupshowing, 3, "Correct number of popupshowing events received");
77 SimpleTest.finish();
78 }
80 let eventCount = {
81 popupshowing: 0,
82 clickbutton1: 0,
83 clickbutton2: 0
84 };
86 function eventReceived(eventName) {
87 eventCount[eventName]++;
88 }
90 ]]>
91 </script>
92 </window>