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 | https://bugzilla.mozilla.org/show_bug.cgi?id=468176 |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="Test for Bug 468176" |
michael@0 | 8 | id="test_bug468176_xul" |
michael@0 | 9 | xmlns:html="http://www.w3.org/1999/xhtml" |
michael@0 | 10 | xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 11 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 12 | |
michael@0 | 13 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 14 | |
michael@0 | 15 | <body id="body" xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 16 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468176">Mozilla Bug 468176</a> |
michael@0 | 17 | |
michael@0 | 18 | <xul:hbox id="b1" value="foo"/> |
michael@0 | 19 | |
michael@0 | 20 | <xul:hbox id="o1"> |
michael@0 | 21 | <xul:observes id="inner" element="b1" attribute="*"/> |
michael@0 | 22 | </xul:hbox> |
michael@0 | 23 | |
michael@0 | 24 | <pre id="test"> |
michael@0 | 25 | <script class="testbody" type="text/javascript"> |
michael@0 | 26 | <![CDATA[ |
michael@0 | 27 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 28 | |
michael@0 | 29 | var broadcastCount = 0; |
michael@0 | 30 | function b_listener(evt) { |
michael@0 | 31 | ++broadcastCount; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function do_test() { |
michael@0 | 35 | var b1 = document.getElementById("b1"); |
michael@0 | 36 | var o1 = document.getElementById("o1"); |
michael@0 | 37 | var inner = document.getElementById("inner"); |
michael@0 | 38 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (1)"); |
michael@0 | 39 | |
michael@0 | 40 | inner.addEventListener("broadcast", b_listener, true); |
michael@0 | 41 | b1.setAttribute("value", "bar"); |
michael@0 | 42 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (2)"); |
michael@0 | 43 | is(broadcastCount, 1, "Wrong value (3)"); |
michael@0 | 44 | |
michael@0 | 45 | b1.removeAttribute("value"); |
michael@0 | 46 | is(o1.hasAttribute("value"), b1.hasAttribute("value"), "Wrong value (4)"); |
michael@0 | 47 | is(broadcastCount, 2, "Wrong value (5)"); |
michael@0 | 48 | |
michael@0 | 49 | o1.setAttribute("value", "foo"); |
michael@0 | 50 | isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (6)"); |
michael@0 | 51 | is(broadcastCount, 2, "Wrong value (7)"); |
michael@0 | 52 | |
michael@0 | 53 | b1.setAttribute("value", "foobar"); |
michael@0 | 54 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (8)"); |
michael@0 | 55 | is(broadcastCount, 3, "Wrong value (9)"); |
michael@0 | 56 | |
michael@0 | 57 | b1.removeAttribute("value"); |
michael@0 | 58 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (10)"); |
michael@0 | 59 | is(broadcastCount, 4, "Wrong value (11)"); |
michael@0 | 60 | |
michael@0 | 61 | b1.removeAttribute("value"); |
michael@0 | 62 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (12)"); |
michael@0 | 63 | is(broadcastCount, 4, "Wrong value (13)"); |
michael@0 | 64 | |
michael@0 | 65 | o1.setAttribute("value", "bar"); |
michael@0 | 66 | b1.setAttribute("value", "bar"); // This should still dispatch 'broadcast' |
michael@0 | 67 | is(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (14)"); |
michael@0 | 68 | is(broadcastCount, 5, "Wrong value (15)"); |
michael@0 | 69 | |
michael@0 | 70 | //After removing listener, changes to broadcaster shouldn't have any effect. |
michael@0 | 71 | o1.parentNode.removeChild(o1); |
michael@0 | 72 | b1.setAttribute("value", "foo"); |
michael@0 | 73 | isnot(o1.getAttribute("value"), b1.getAttribute("value"), "Wrong value (16)"); |
michael@0 | 74 | is(broadcastCount, 5, "Wrong value (17)"); |
michael@0 | 75 | |
michael@0 | 76 | SimpleTest.finish(); |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | addLoadEvent(do_test); |
michael@0 | 80 | ]]> |
michael@0 | 81 | </script> |
michael@0 | 82 | </pre> |
michael@0 | 83 | </body> |
michael@0 | 84 | </window> |