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=619644 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 619644</title> |
michael@0 | 8 | <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619644">Mozilla Bug 619644</a> |
michael@0 | 15 | <pre id="test"> |
michael@0 | 16 | <script class="testbody" type="text/javascript"> |
michael@0 | 17 | function hasTabModalPrompts() { |
michael@0 | 18 | var prefName = "prompts.tab_modal.enabled"; |
michael@0 | 19 | Services = SpecialPowers.Services; |
michael@0 | 20 | return Services.prefs.getPrefType(prefName) == Services.prefs.PREF_BOOL && |
michael@0 | 21 | Services.prefs.getBoolPref(prefName); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | if (!hasTabModalPrompts()) { |
michael@0 | 25 | todo(false, "Test disabled when tab modal prompts are not enabled."); |
michael@0 | 26 | } else { |
michael@0 | 27 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 28 | |
michael@0 | 29 | // This is a little yucky, but it works |
michael@0 | 30 | // The contents of bug619644_inner.html |
michael@0 | 31 | const expectedFinalDoc = |
michael@0 | 32 | "<head><\/head><body><p>Original content<\/p>\n<script>\n window.opener.postMessage(\"\", \"*\");\n confirm (\"Message\");\n document.write (\"Extra content\");\n window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>"; |
michael@0 | 33 | |
michael@0 | 34 | function runtest(e) |
michael@0 | 35 | { |
michael@0 | 36 | window.removeEventListener("message", runtest, false); |
michael@0 | 37 | window.addEventListener("message", checktest, false); |
michael@0 | 38 | synthesizeKey("VK_ESCAPE", {}, e.source); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | function checktest(e) { |
michael@0 | 42 | is(e.data, expectedFinalDoc, "ESC press should not abort document load"); |
michael@0 | 43 | e.source.close(); |
michael@0 | 44 | SimpleTest.finish(); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | window.addEventListener("message", runtest, false); |
michael@0 | 48 | window.open("bug619644_inner.html", "619644"); |
michael@0 | 49 | } |
michael@0 | 50 | </script> |
michael@0 | 51 | </pre> |
michael@0 | 52 | </body> |
michael@0 | 53 | </html> |