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.
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="Tests for focus on elements with anonymous focusable children" |
michael@0 | 6 | onload="setTimeout(runTests, 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 | <label accesskey="a" control="menulist"/> |
michael@0 | 13 | <label accesskey="b" control="textbox"/> |
michael@0 | 14 | <label accesskey="c" control="scale"/> |
michael@0 | 15 | |
michael@0 | 16 | <menulist id="menulist" editable="true"> |
michael@0 | 17 | <menupopup> |
michael@0 | 18 | <menuitem label="One"/> |
michael@0 | 19 | </menupopup> |
michael@0 | 20 | </menulist> |
michael@0 | 21 | <textbox id="textbox"/> |
michael@0 | 22 | <scale id="scale"/> |
michael@0 | 23 | |
michael@0 | 24 | <script class="testbody" type="application/javascript"> |
michael@0 | 25 | <![CDATA[ |
michael@0 | 26 | |
michael@0 | 27 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 28 | |
michael@0 | 29 | var gBlurs = 0, gFocuses = 0; |
michael@0 | 30 | var gExpectedBlur = ""; |
michael@0 | 31 | var gExpectedFocus = ""; |
michael@0 | 32 | |
michael@0 | 33 | function blurOccurred(event) { |
michael@0 | 34 | gBlurs++; |
michael@0 | 35 | is(event.originalTarget, gExpectedBlur, "blur " + gBlurs + "," + event.originalTarget.localName); |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | function focusOccurred(event) { |
michael@0 | 39 | gFocuses++; |
michael@0 | 40 | is(event.originalTarget, gExpectedFocus, "focus " + gFocuses + "," + event.originalTarget.localName); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | function runTests() |
michael@0 | 44 | { |
michael@0 | 45 | addEventListener("focus", focusOccurred, true); |
michael@0 | 46 | addEventListener("blur", blurOccurred, true); |
michael@0 | 47 | |
michael@0 | 48 | gExpectedBlur = null; |
michael@0 | 49 | gExpectedFocus = $("menulist").inputField; |
michael@0 | 50 | $("menulist").focus(); |
michael@0 | 51 | |
michael@0 | 52 | gExpectedBlur = gExpectedFocus; |
michael@0 | 53 | gExpectedFocus = $("textbox").inputField; |
michael@0 | 54 | $("textbox").focus(); |
michael@0 | 55 | |
michael@0 | 56 | gExpectedBlur = gExpectedFocus; |
michael@0 | 57 | gExpectedFocus = document.getAnonymousNodes($("scale"))[0]; |
michael@0 | 58 | $("scale").focus(); |
michael@0 | 59 | |
michael@0 | 60 | var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ? |
michael@0 | 61 | { altKey: true, ctrlKey : true } : |
michael@0 | 62 | { altKey : true, shiftKey: true }; |
michael@0 | 63 | |
michael@0 | 64 | gExpectedBlur = document.getAnonymousNodes($("scale"))[0]; |
michael@0 | 65 | gExpectedFocus = $("menulist").inputField; |
michael@0 | 66 | synthesizeKey("a", accessKeyDetails); |
michael@0 | 67 | |
michael@0 | 68 | gExpectedBlur = gExpectedFocus; |
michael@0 | 69 | gExpectedFocus = $("textbox").inputField; |
michael@0 | 70 | synthesizeKey("b", accessKeyDetails); |
michael@0 | 71 | |
michael@0 | 72 | gExpectedBlur = gExpectedFocus; |
michael@0 | 73 | gExpectedFocus = document.getAnonymousNodes($("scale"))[0]; |
michael@0 | 74 | synthesizeKey("c", accessKeyDetails); |
michael@0 | 75 | |
michael@0 | 76 | if (navigator.platform.indexOf("Mac") == -1) { |
michael@0 | 77 | gExpectedBlur = gExpectedFocus; |
michael@0 | 78 | gExpectedFocus = $("textbox").inputField; |
michael@0 | 79 | synthesizeKey("VK_TAB", { shiftKey: true }); |
michael@0 | 80 | |
michael@0 | 81 | gExpectedBlur = gExpectedFocus; |
michael@0 | 82 | gExpectedFocus = $("menulist").inputField; |
michael@0 | 83 | synthesizeKey("VK_TAB", { shiftKey: true }); |
michael@0 | 84 | |
michael@0 | 85 | gExpectedBlur = gExpectedFocus; |
michael@0 | 86 | gExpectedFocus = $("textbox").inputField; |
michael@0 | 87 | synthesizeKey("VK_TAB", { }); |
michael@0 | 88 | |
michael@0 | 89 | gExpectedBlur = gExpectedFocus; |
michael@0 | 90 | gExpectedFocus = document.getAnonymousNodes($("scale"))[0]; |
michael@0 | 91 | synthesizeKey("VK_TAB", { }); |
michael@0 | 92 | |
michael@0 | 93 | is(gBlurs, 9, "correct number of blurs"); |
michael@0 | 94 | is(gFocuses, 10, "correct number of focuses"); |
michael@0 | 95 | } |
michael@0 | 96 | else { |
michael@0 | 97 | is(gBlurs, 5, "correct number of blurs"); |
michael@0 | 98 | is(gFocuses, 6, "correct number of focuses"); |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | removeEventListener("focus", focusOccurred, true); |
michael@0 | 102 | removeEventListener("blur", blurOccurred, true); |
michael@0 | 103 | |
michael@0 | 104 | SimpleTest.finish(); |
michael@0 | 105 | } |
michael@0 | 106 | |
michael@0 | 107 | ]]> |
michael@0 | 108 | </script> |
michael@0 | 109 | |
michael@0 | 110 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 111 | <p id="display"> |
michael@0 | 112 | </p> |
michael@0 | 113 | <div id="content" style="display: none"> |
michael@0 | 114 | </div> |
michael@0 | 115 | <pre id="test"> |
michael@0 | 116 | </pre> |
michael@0 | 117 | </body> |
michael@0 | 118 | |
michael@0 | 119 | </window> |