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=403868 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 403868</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=403868">Mozilla Bug 403868</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript"> |
michael@0 | 19 | |
michael@0 | 20 | /** Test for Bug 403868 **/ |
michael@0 | 21 | function createSpan(id, insertionPoint) { |
michael@0 | 22 | var s = document.createElement("span"); |
michael@0 | 23 | s.id = id; |
michael@0 | 24 | $("content").insertBefore(s, insertionPoint); |
michael@0 | 25 | return s; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | var s1a = createSpan("test1", null); |
michael@0 | 29 | is(document.getElementById("test1"), s1a, |
michael@0 | 30 | "Only one span with id=test1 in the tree; should work!"); |
michael@0 | 31 | |
michael@0 | 32 | var s2a = createSpan("test1", null); |
michael@0 | 33 | is(document.getElementById("test1"), s1a, |
michael@0 | 34 | "Appending span with id=test1 doesn't change which one comes first"); |
michael@0 | 35 | |
michael@0 | 36 | var s3a = createSpan("test1", s2a); |
michael@0 | 37 | is(document.getElementById("test1"), s1a, |
michael@0 | 38 | "Inserting span with id=test1 not at the beginning; doesn't matter"); |
michael@0 | 39 | |
michael@0 | 40 | var s4a = createSpan("test1", s1a); |
michael@0 | 41 | is(document.getElementById("test1"), s4a, |
michael@0 | 42 | "Inserting span with id=test1 at the beginning changes which one is first"); |
michael@0 | 43 | |
michael@0 | 44 | s4a.parentNode.removeChild(s4a); |
michael@0 | 45 | is(document.getElementById("test1"), s1a, |
michael@0 | 46 | "First-created span with id=test1 is first again"); |
michael@0 | 47 | |
michael@0 | 48 | s1a.parentNode.removeChild(s1a); |
michael@0 | 49 | is(document.getElementById("test1"), s3a, |
michael@0 | 50 | "Third-created span with id=test1 is first now"); |
michael@0 | 51 | |
michael@0 | 52 | // Start the id hashtable |
michael@0 | 53 | for (var i = 0; i < 256; ++i) { |
michael@0 | 54 | document.getElementById("no-such-id-in-the-document" + i); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | var s1b = createSpan("test2", null); |
michael@0 | 58 | is(document.getElementById("test2"), s1b, |
michael@0 | 59 | "Only one span with id=test2 in the tree; should work!"); |
michael@0 | 60 | |
michael@0 | 61 | var s2b = createSpan("test2", null); |
michael@0 | 62 | is(document.getElementById("test2"), s1b, |
michael@0 | 63 | "Appending span with id=test2 doesn't change which one comes first"); |
michael@0 | 64 | |
michael@0 | 65 | var s3b = createSpan("test2", s2b); |
michael@0 | 66 | is(document.getElementById("test2"), s1b, |
michael@0 | 67 | "Inserting span with id=test2 not at the beginning; doesn't matter"); |
michael@0 | 68 | |
michael@0 | 69 | var s4b = createSpan("test2", s1b); |
michael@0 | 70 | is(document.getElementById("test2"), s4b, |
michael@0 | 71 | "Inserting span with id=test2 at the beginning changes which one is first"); |
michael@0 | 72 | |
michael@0 | 73 | s4b.parentNode.removeChild(s4b); |
michael@0 | 74 | is(document.getElementById("test2"), s1b, |
michael@0 | 75 | "First-created span with id=test2 is first again"); |
michael@0 | 76 | |
michael@0 | 77 | s1b.parentNode.removeChild(s1b); |
michael@0 | 78 | is(document.getElementById("test2"), s3b, |
michael@0 | 79 | "Third-created span with id=test2 is first now"); |
michael@0 | 80 | |
michael@0 | 81 | |
michael@0 | 82 | |
michael@0 | 83 | </script> |
michael@0 | 84 | </pre> |
michael@0 | 85 | </body> |
michael@0 | 86 | </html> |
michael@0 | 87 |