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=490879 |
michael@0 | 8 | --> |
michael@0 | 9 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | title="Mozilla Bug 490879" 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=490879" |
michael@0 | 16 | target="_blank">Mozilla Bug 490879</a> |
michael@0 | 17 | <p/> |
michael@0 | 18 | <iframe id="i1" width="200" height="100" src="about:blank" /><br /> |
michael@0 | 19 | <img id="i" src="green.png" /> |
michael@0 | 20 | <p/> |
michael@0 | 21 | <pre id="test"> |
michael@0 | 22 | </pre> |
michael@0 | 23 | </body> |
michael@0 | 24 | <script class="testbody" type="application/javascript"> |
michael@0 | 25 | <![CDATA[ |
michael@0 | 26 | |
michael@0 | 27 | function runTest() { |
michael@0 | 28 | function verifyContent() { |
michael@0 | 29 | const kExpectedImgSpec = "data:image/png;base64,"; |
michael@0 | 30 | var e = document.getElementById('i1'); |
michael@0 | 31 | var doc = e.contentDocument; |
michael@0 | 32 | is(doc.getElementsByTagName("img")[0].src.substring(0, kExpectedImgSpec.length), |
michael@0 | 33 | kExpectedImgSpec, "The pasted image is a base64-encoded data: URI"); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | function pasteInto() { |
michael@0 | 37 | var e = document.getElementById('i1'); |
michael@0 | 38 | var doc = e.contentDocument; |
michael@0 | 39 | doc.designMode = "on"; |
michael@0 | 40 | doc.defaultView.focus(); |
michael@0 | 41 | var selection = doc.defaultView.getSelection(); |
michael@0 | 42 | selection.removeAllRanges(); |
michael@0 | 43 | selection.selectAllChildren(doc.body); |
michael@0 | 44 | selection.collapseToEnd(); |
michael@0 | 45 | doc.execCommand("paste", false, null); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function copyToClipBoard() { |
michael@0 | 49 | var tmpNode = document.popupNode; |
michael@0 | 50 | document.popupNode = document.getElementById("i"); |
michael@0 | 51 | |
michael@0 | 52 | const kCmd = "cmd_copyImageContents"; |
michael@0 | 53 | var controller = top.document.commandDispatcher |
michael@0 | 54 | .getControllerForCommand(kCmd); |
michael@0 | 55 | ok((controller && controller.isCommandEnabled(kCmd)), "have copy command"); |
michael@0 | 56 | controller.doCommand(kCmd); |
michael@0 | 57 | |
michael@0 | 58 | document.popupNode = tmpNode; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | copyToClipBoard(); |
michael@0 | 62 | pasteInto(); |
michael@0 | 63 | verifyContent(); |
michael@0 | 64 | |
michael@0 | 65 | SimpleTest.finish(); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 69 | ]]> |
michael@0 | 70 | </script> |
michael@0 | 71 | </window> |