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 | let port, es; |
michael@0 | 2 | |
michael@0 | 3 | let url = "https://example.com/browser/toolkit/components/social/test/browser/eventsource.resource"; |
michael@0 | 4 | |
michael@0 | 5 | function ok(a, msg) { |
michael@0 | 6 | port.postMessage({topic: "eventSourceTest", |
michael@0 | 7 | result: {ok: a, msg: msg}}); |
michael@0 | 8 | } |
michael@0 | 9 | |
michael@0 | 10 | function is(a, b, msg) { |
michael@0 | 11 | port.postMessage({topic: "eventSourceTest", |
michael@0 | 12 | result: {is: a, match: b, msg: msg}}); |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | function esListener(e) { |
michael@0 | 16 | esListener.msg_ok = true; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | function esOnmessage(e) { |
michael@0 | 20 | ok(true, "onmessage test"); |
michael@0 | 21 | ok(esListener.msg_ok, "listener test"); |
michael@0 | 22 | es.close(); |
michael@0 | 23 | port.postMessage({topic: "pong"}); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function doTest() { |
michael@0 | 27 | try { |
michael@0 | 28 | es = new EventSource(url); |
michael@0 | 29 | is(es.url, url, "eventsource.resource accessed", "we can create an eventsource instance"); |
michael@0 | 30 | es.addEventListener('test-message', esListener, true); |
michael@0 | 31 | es.onmessage = esOnmessage; |
michael@0 | 32 | } catch (e) {} |
michael@0 | 33 | ok(!!es, "we can create an eventsource instance"); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | onconnect = function(e) { |
michael@0 | 37 | port = e.ports[0]; |
michael@0 | 38 | port.onmessage = function(e) { |
michael@0 | 39 | if (e.data.topic == "ping") { |
michael@0 | 40 | doTest(); |
michael@0 | 41 | } |
michael@0 | 42 | } |
michael@0 | 43 | } |