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" |
michael@0 | 3 | type="text/css"?> |
michael@0 | 4 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 5 | type="text/css"?> |
michael@0 | 6 | <!-- |
michael@0 | 7 | https://bugzilla.mozilla.org/show_bug.cgi?id=646194 |
michael@0 | 8 | --> |
michael@0 | 9 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | title="Mozilla Bug 646194" onload="runTest();"> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 13 | |
michael@0 | 14 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 15 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646194" |
michael@0 | 16 | target="_blank">Mozilla Bug 646194</a> |
michael@0 | 17 | <p/> |
michael@0 | 18 | <iframe id="i" src="data:text/html,<div contenteditable=true id=t>test me now</div>"/> |
michael@0 | 19 | <p/> |
michael@0 | 20 | <pre id="test"> |
michael@0 | 21 | </pre> |
michael@0 | 22 | </body> |
michael@0 | 23 | <script class="testbody" type="application/javascript"> |
michael@0 | 24 | <![CDATA[ |
michael@0 | 25 | |
michael@0 | 26 | SimpleTest.expectAssertions(1); |
michael@0 | 27 | |
michael@0 | 28 | function runTest() { |
michael@0 | 29 | function doCommand(aCmd) { |
michael@0 | 30 | var controller = top.document.commandDispatcher |
michael@0 | 31 | .getControllerForCommand(aCmd); |
michael@0 | 32 | ok((controller && controller.isCommandEnabled(aCmd)), "command available"); |
michael@0 | 33 | controller.doCommand(aCmd); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | var i = document.getElementById("i"); |
michael@0 | 37 | i.focus(); |
michael@0 | 38 | var win = i.contentWindow; |
michael@0 | 39 | var doc = i.contentDocument; |
michael@0 | 40 | var t = doc.getElementById("t"); |
michael@0 | 41 | t.focus(); |
michael@0 | 42 | // put the caret at the end |
michael@0 | 43 | win.getSelection().collapse(t.firstChild, 11); |
michael@0 | 44 | |
michael@0 | 45 | // Simulate pression Option+Delete on Mac |
michael@0 | 46 | // We do things this way because not every platform can invoke this |
michael@0 | 47 | // command using the available key bindings. |
michael@0 | 48 | doCommand("cmd_wordPrevious"); |
michael@0 | 49 | doCommand("cmd_wordPrevious"); |
michael@0 | 50 | doCommand("cmd_deleteWordBackward"); |
michael@0 | 51 | doCommand("cmd_deleteWordBackward"); |
michael@0 | 52 | |
michael@0 | 53 | // If we reach here, we haven't crashed. Phew! |
michael@0 | 54 | // But let's check the value too, now that we're here. |
michael@0 | 55 | is(t.textContent, "me now", "The command has worked correctly"); |
michael@0 | 56 | |
michael@0 | 57 | SimpleTest.finish(); |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 61 | ]]> |
michael@0 | 62 | </script> |
michael@0 | 63 | </window> |