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="Popup Prevent Default Tests"
6 onload="setTimeout(runTest, 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>
11 <!--
12 This tests checks that preventDefault can be called on a popupshowing
13 event and that preventDefault has no effect for the popuphiding event.
14 -->
16 <script>
17 SimpleTest.waitForExplicitFinish();
19 var gBlockShowing = true;
20 var gShownNotAllowed = true;
22 function runTest()
23 {
24 document.getElementById("menu").open = true;
25 }
27 function popupShowing(event)
28 {
29 if (gBlockShowing) {
30 event.preventDefault();
31 gBlockShowing = false;
32 setTimeout(function() {
33 gShownNotAllowed = false;
34 document.getElementById("menu").open = true;
35 }, 3000, true);
36 }
37 }
39 function popupShown()
40 {
41 ok(!gShownNotAllowed, "popupshowing preventDefault");
42 document.getElementById("menu").open = false;
43 }
45 function popupHiding(event)
46 {
47 // since this is a content test, preventDefault should have no effect
48 event.preventDefault();
49 }
51 function popupHidden()
52 {
53 ok(true, "popuphiding preventDefault not allowed");
54 SimpleTest.finish();
55 }
56 </script>
58 <button id="menu" type="menu" label="Menu">
59 <menupopup onpopupshowing="popupShowing(event);"
60 onpopupshown="popupShown();"
61 onpopuphiding="popupHiding(event);"
62 onpopuphidden="popupHidden();">
63 <menuitem label="Item"/>
64 </menupopup>
65 </button>
67 <body xmlns="http://www.w3.org/1999/xhtml">
68 <p id="display">
69 </p>
70 <div id="content" style="display: none">
71 </div>
72 <pre id="test">
73 </pre>
74 </body>
76 </window>