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 type="text/css" href="chrome://global/skin"?> |
michael@0 | 3 | <?xml-stylesheet type="text/css" |
michael@0 | 4 | href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
michael@0 | 5 | <!-- |
michael@0 | 6 | https://bugzilla.mozilla.org/show_bug.cgi?id=617528 |
michael@0 | 7 | --> |
michael@0 | 8 | <window title="Mozilla Bug 617528" |
michael@0 | 9 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 10 | |
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=617528" |
michael@0 | 16 | target="_blank">Mozilla Bug 617528</a> |
michael@0 | 17 | </body> |
michael@0 | 18 | |
michael@0 | 19 | <script type="application/javascript"><![CDATA[ |
michael@0 | 20 | var _window; |
michael@0 | 21 | var browser; |
michael@0 | 22 | |
michael@0 | 23 | function start() { |
michael@0 | 24 | _window = window.open("window_bug617528.xul", "_new", "chrome"); |
michael@0 | 25 | _window.addEventListener("load", onLoad, false); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function onLoad() { |
michael@0 | 29 | _window.removeEventListener("load", onLoad, false); |
michael@0 | 30 | |
michael@0 | 31 | browser = _window.document.getElementById("browser"); |
michael@0 | 32 | browser.addEventListener("pageshow", onPageShow, false); |
michael@0 | 33 | |
michael@0 | 34 | var uri='data:text/html,\ |
michael@0 | 35 | <html>\ |
michael@0 | 36 | <body>\ |
michael@0 | 37 | <div oncontextmenu="event.preventDefault()">\ |
michael@0 | 38 | <input id="node" type="text" value="Click here"></input>\ |
michael@0 | 39 | </div>\ |
michael@0 | 40 | </body>\ |
michael@0 | 41 | </html>'; |
michael@0 | 42 | browser.loadURI(uri); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function onPageShow() { |
michael@0 | 46 | browser.removeEventListener("pageshow", onPageShow, true); |
michael@0 | 47 | SimpleTest.executeSoon(doTest); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | function onContextMenu1(event) { |
michael@0 | 51 | is(event.defaultPrevented, true, |
michael@0 | 52 | "expected event.defaultPrevented to be true (1)"); |
michael@0 | 53 | is(event.target.localName, "input", |
michael@0 | 54 | "expected event.target.localName to be 'input' (1)"); |
michael@0 | 55 | is(event.originalTarget.localName, "div", |
michael@0 | 56 | "expected event.originalTarget.localName to be 'div' (1)"); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | function onContextMenu2(event) { |
michael@0 | 60 | is(event.defaultPrevented, false, |
michael@0 | 61 | "expected event.defaultPrevented to be false (2)"); |
michael@0 | 62 | is(event.target.localName, "input", |
michael@0 | 63 | "expected event.target.localName to be 'input' (2)"); |
michael@0 | 64 | is(event.originalTarget.localName, "div", |
michael@0 | 65 | "expected event.originalTarget.localName to be 'div' (2)"); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | function doTest() { |
michael@0 | 69 | var win = browser.contentWindow; |
michael@0 | 70 | win.focus(); |
michael@0 | 71 | var node = win.document.getElementById("node"); |
michael@0 | 72 | var rect = node.getBoundingClientRect(); |
michael@0 | 73 | var left = rect.left + rect.width / 2; |
michael@0 | 74 | var top = rect.top + rect.height / 2; |
michael@0 | 75 | |
michael@0 | 76 | var wu = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
michael@0 | 77 | .getInterface(Components.interfaces.nsIDOMWindowUtils); |
michael@0 | 78 | |
michael@0 | 79 | browser.addEventListener("contextmenu", onContextMenu1, false); |
michael@0 | 80 | wu.sendMouseEvent("contextmenu", left, top, 2, 1, 0); |
michael@0 | 81 | browser.removeEventListener("contextmenu", onContextMenu1, false); |
michael@0 | 82 | |
michael@0 | 83 | browser.addEventListener("contextmenu", onContextMenu2, false); |
michael@0 | 84 | var shiftMask = Components.interfaces.nsIDOMEvent.SHIFT_MASK; |
michael@0 | 85 | wu.sendMouseEvent("contextmenu", left, top, 2, 1, shiftMask); |
michael@0 | 86 | browser.removeEventListener("contextmenu", onContextMenu2, false); |
michael@0 | 87 | |
michael@0 | 88 | _window.close(); |
michael@0 | 89 | SimpleTest.finish(); |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | addLoadEvent(start); |
michael@0 | 93 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 94 | ]]></script> |
michael@0 | 95 | </window> |