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 | // Used to test XHR in the worker. |
michael@0 | 2 | onconnect = function(e) { |
michael@0 | 3 | let port = e.ports[0]; |
michael@0 | 4 | let req; |
michael@0 | 5 | try { |
michael@0 | 6 | req = new XMLHttpRequest(); |
michael@0 | 7 | } catch(e) { |
michael@0 | 8 | port.postMessage({topic: "done", result: "FAILED to create XHR object, " + e.toString() }); |
michael@0 | 9 | } |
michael@0 | 10 | if (req === undefined) { // until bug 756173 is fixed... |
michael@0 | 11 | port.postMessage({topic: "done", result: "FAILED to create XHR object"}); |
michael@0 | 12 | return; |
michael@0 | 13 | } |
michael@0 | 14 | // The test that uses this worker MUST use the same origin to load the worker. |
michael@0 | 15 | // We fetch the test app manifest so we can check the data is what we expect. |
michael@0 | 16 | let url = "https://example.com/browser/toolkit/components/social/test/browser/data.json"; |
michael@0 | 17 | req.open("GET", url, true); |
michael@0 | 18 | req.onreadystatechange = function() { |
michael@0 | 19 | if (req.readyState === 4) { |
michael@0 | 20 | let ok = req.status == 200 && req.responseText.length > 0; |
michael@0 | 21 | if (ok) { |
michael@0 | 22 | // check we actually got something sane... |
michael@0 | 23 | try { |
michael@0 | 24 | let data = JSON.parse(req.responseText); |
michael@0 | 25 | ok = "response" in data; |
michael@0 | 26 | } catch(e) { |
michael@0 | 27 | ok = e.toString(); |
michael@0 | 28 | } |
michael@0 | 29 | } |
michael@0 | 30 | port.postMessage({topic: "done", result: ok ? "ok" : "bad response"}); |
michael@0 | 31 | } |
michael@0 | 32 | } |
michael@0 | 33 | req.send(null); |
michael@0 | 34 | } |