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"?>
5 <window title="Hidden Popup Test"
6 onload="setTimeout(runTests, 0, $('popup'));"
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>
11 <menupopup id="popup" hidden="true" onpopupshown="ok(true, 'popupshown'); this.hidePopup()"
12 onpopuphidden="$('popup-hideonshow').openPopup(null, 'after_start')">
13 <menuitem id="i1" label="One"/>
14 <menuitem id="i2" label="Two"/>
15 </menupopup>
17 <menupopup id="popup-hideonshow" onpopupshowing="hidePopupWhileShowing(this)"
18 onpopupshown="ok(false, 'popupshown when hidden')">
19 <menuitem id="i1" label="One"/>
20 <menuitem id="i2" label="Two"/>
21 </menupopup>
23 <button id="button" type="menu" label="Menu" onDOMAttrModified="checkEndTest(event)">
24 <menupopup id="popupinbutton" hidden="true"
25 onpopupshown="ok(true, 'popupshown'); ok($('button').open, 'open'); this.hidden = true;">
26 <menuitem id="i1" label="One"/>
27 <menuitem id="i2" label="Two"/>
28 </menupopup>
29 </button>
31 <script class="testbody" type="application/javascript">
32 <![CDATA[
34 SimpleTest.waitForExplicitFinish();
36 function runTests(popup)
37 {
38 popup.hidden = false;
39 popup.openPopup(null, "after_start");
40 }
42 function hidePopupWhileShowing(popup)
43 {
44 popup.hidden = true;
45 popup.clientWidth; // flush layout
46 is(popup.state, 'closed', 'popupshowing hidden');
47 SimpleTest.executeSoon(function () runTests($('popupinbutton')));
48 }
50 function checkEndTest(event)
51 {
52 var button = $("button");
53 if (event.originalTarget != button || event.attrName != 'open' || event.attrChange != event.REMOVAL)
54 return;
56 ok($("popupinbutton").hidden, "popup hidden");
57 is($("popupinbutton").state, "closed", "popup state");
58 ok(!button.open, "not open after hidden");
59 SimpleTest.finish();
60 }
62 ]]>
63 </script>
65 <body xmlns="http://www.w3.org/1999/xhtml">
66 <p id="display">
67 </p>
68 <div id="content" style="display: none">
69 </div>
70 <pre id="test">
71 </pre>
72 </body>
74 </window>