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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=172261 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 172261</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=172261">Mozilla Bug 172261</a> |
michael@0 | 13 | <p id="display"> |
michael@0 | 14 | <iframe id="test"></iframe> |
michael@0 | 15 | </p> |
michael@0 | 16 | <div id="content" style="display: none"> |
michael@0 | 17 | |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script class="testbody" type="text/javascript"> |
michael@0 | 21 | /** Test for Bug 172261 **/ |
michael@0 | 22 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 23 | |
michael@0 | 24 | var callable = false; |
michael@0 | 25 | function toggleCallable() { callable = true; } |
michael@0 | 26 | |
michael@0 | 27 | var doTestInIframe = false; |
michael@0 | 28 | |
michael@0 | 29 | // Shouldn't do history stuff from inside onload |
michael@0 | 30 | addLoadEvent(function() { setTimeout(startTest, 10) }); |
michael@0 | 31 | |
michael@0 | 32 | function startTest() { |
michael@0 | 33 | // First, create a dummy document. Use onunload handlers to make sure |
michael@0 | 34 | // bfcache doesn't screw us up. |
michael@0 | 35 | var doc = $("test").contentDocument; |
michael@0 | 36 | |
michael@0 | 37 | doc.write("<html><body onunload=''>First</body></html>"); |
michael@0 | 38 | doc.close(); |
michael@0 | 39 | |
michael@0 | 40 | // Now write our test document |
michael@0 | 41 | doc.write("<html><script>window.onerror = parent.onerror; if (parent.doTestInIframe) { parent.is(document.domain, parent.document.domain, 'Domains should match'); parent.toggleCallable(); } <" + "/script><body>Second</body></html>"); |
michael@0 | 42 | doc.close(); |
michael@0 | 43 | |
michael@0 | 44 | $("test").onload = goForward; |
michael@0 | 45 | history.back(); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | function goForward() { |
michael@0 | 49 | $("test").onload = doTest; |
michael@0 | 50 | doTestInIframe = true; |
michael@0 | 51 | history.forward(); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function doTest() { |
michael@0 | 55 | is($("test").contentDocument.domain, document.domain, |
michael@0 | 56 | "Domains should match 2"); |
michael@0 | 57 | is($("test").contentDocument.location.href, location.href, |
michael@0 | 58 | "Locations should match"); |
michael@0 | 59 | is(callable, true, "Subframe should be able to call us"); |
michael@0 | 60 | SimpleTest.finish(); |
michael@0 | 61 | } |
michael@0 | 62 | </script> |
michael@0 | 63 | </pre> |
michael@0 | 64 | </body> |
michael@0 | 65 | </html> |
michael@0 | 66 |