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 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <!-- |
michael@0 | 3 | https://bugzilla.mozilla.org/show_bug.cgi?id=332848 |
michael@0 | 4 | --> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>Test for Bug 332848</title> |
michael@0 | 7 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
michael@0 | 11 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332848">Mozilla Bug 332848</a> |
michael@0 | 12 | <p id="display"></p> |
michael@0 | 13 | <div id="content" style="display: none"> |
michael@0 | 14 | |
michael@0 | 15 | </div> |
michael@0 | 16 | <pre id="test"> |
michael@0 | 17 | <script class="testbody" type="text/javascript"> |
michael@0 | 18 | <![CDATA[ |
michael@0 | 19 | |
michael@0 | 20 | /** Test for Bug 332848 **/ |
michael@0 | 21 | |
michael@0 | 22 | // parseChecker will become true if we keep parsing after calling close(). |
michael@0 | 23 | var parseChecker = false; |
michael@0 | 24 | |
michael@0 | 25 | function test() { |
michael@0 | 26 | try { |
michael@0 | 27 | document.open(); |
michael@0 | 28 | is(0, 1, "document.open succeeded"); |
michael@0 | 29 | } catch (e) { |
michael@0 | 30 | is (e.name, "InvalidStateError", |
michael@0 | 31 | "Wrong exception from document.open"); |
michael@0 | 32 | is (e.code, DOMException.INVALID_STATE_ERR, |
michael@0 | 33 | "Wrong exception from document.open"); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | try { |
michael@0 | 37 | document.write("aaa"); |
michael@0 | 38 | is(0, 1, "document.write succeeded"); |
michael@0 | 39 | } catch (e) { |
michael@0 | 40 | is (e.name, "InvalidStateError", |
michael@0 | 41 | "Wrong exception from document.write"); |
michael@0 | 42 | is (e.code, DOMException.INVALID_STATE_ERR, |
michael@0 | 43 | "Wrong exception from document.write"); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | try { |
michael@0 | 47 | document.writeln("aaa"); |
michael@0 | 48 | is(0, 1, "document.write succeeded"); |
michael@0 | 49 | } catch (e) { |
michael@0 | 50 | is (e.name, "InvalidStateError", |
michael@0 | 51 | "Wrong exception from document.write"); |
michael@0 | 52 | is (e.code, DOMException.INVALID_STATE_ERR, |
michael@0 | 53 | "Wrong exception from document.write"); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | try { |
michael@0 | 57 | document.close(); |
michael@0 | 58 | is(0, 1, "document.close succeeded"); |
michael@0 | 59 | } catch (e) { |
michael@0 | 60 | is (e.name, "InvalidStateError", |
michael@0 | 61 | "Wrong exception from document.close"); |
michael@0 | 62 | is (e.code, DOMException.INVALID_STATE_ERR, |
michael@0 | 63 | "Wrong exception from document.close"); |
michael@0 | 64 | } |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | function loadTest() { |
michael@0 | 68 | is(parseChecker, true, "Parsing stopped"); |
michael@0 | 69 | test(); |
michael@0 | 70 | SimpleTest.finish(); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | window.onload = loadTest; |
michael@0 | 74 | |
michael@0 | 75 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 76 | |
michael@0 | 77 | test(); |
michael@0 | 78 | ]]> |
michael@0 | 79 | </script> |
michael@0 | 80 | <script> |
michael@0 | 81 | parseChecker = true; |
michael@0 | 82 | </script> |
michael@0 | 83 | </pre> |
michael@0 | 84 | </body> |
michael@0 | 85 | </html> |
michael@0 | 86 |