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=725907 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 725907</title> |
michael@0 | 9 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | </head> |
michael@0 | 12 | <body> |
michael@0 | 13 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=725907">Mozilla Bug 725907</a> |
michael@0 | 14 | <p id="display"></p> |
michael@0 | 15 | <div id="content" style="display: none"> |
michael@0 | 16 | |
michael@0 | 17 | </div> |
michael@0 | 18 | <div id="basket"> |
michael@0 | 19 | <span id="egg0"></span> |
michael@0 | 20 | <span id="egg1"><span id="duckling1"></span></span> |
michael@0 | 21 | <span id="egg2"></span> |
michael@0 | 22 | </div> |
michael@0 | 23 | <pre id="test"> |
michael@0 | 24 | <script type="application/javascript"> |
michael@0 | 25 | |
michael@0 | 26 | /** Test for Bug 725907 **/ |
michael@0 | 27 | |
michael@0 | 28 | function runTestsForDocument(document, msgSuffix) { |
michael@0 | 29 | function is(a, b, msg) { SimpleTest.is(a, b, msg + msgSuffix); } |
michael@0 | 30 | function isnot(a, b, msg) { SimpleTest.isnot(a, b, msg + msgSuffix); } |
michael@0 | 31 | |
michael@0 | 32 | var basket = document.getElementById("basket"); |
michael@0 | 33 | var egg3 = document.createElement("span"); |
michael@0 | 34 | egg3.id = "egg3"; |
michael@0 | 35 | |
michael@0 | 36 | var log = ''; |
michael@0 | 37 | for (var x of basket.childNodes) { |
michael@0 | 38 | if (x.nodeType != x.TEXT_NODE) |
michael@0 | 39 | log += x.id + ";"; |
michael@0 | 40 | } |
michael@0 | 41 | is(log, "egg0;egg1;egg2;", "'for (x of div.childNodes)' should iterate over child nodes"); |
michael@0 | 42 | |
michael@0 | 43 | log = ''; |
michael@0 | 44 | for (var x of basket.childNodes) { |
michael@0 | 45 | if (x.nodeType != x.TEXT_NODE) { |
michael@0 | 46 | log += x.id + ";"; |
michael@0 | 47 | if (x.id == "egg1") |
michael@0 | 48 | basket.appendChild(egg3); |
michael@0 | 49 | } |
michael@0 | 50 | } |
michael@0 | 51 | is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.childNodes)' should see elements added during iteration"); |
michael@0 | 52 | |
michael@0 | 53 | log = ''; |
michael@0 | 54 | basket.appendChild(document.createTextNode("some text")); |
michael@0 | 55 | for (var x of basket.children) |
michael@0 | 56 | log += x.id + ";"; |
michael@0 | 57 | is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.children)' should iterate over child elements"); |
michael@0 | 58 | |
michael@0 | 59 | var count = 0; |
michael@0 | 60 | for (var x of document.getElementsByClassName("hazardous-materials")) |
michael@0 | 61 | count++; |
michael@0 | 62 | is(count, 0, "'for (x of emptyNodeList)' loop should run zero times"); |
michael@0 | 63 | |
michael@0 | 64 | var log = ''; |
michael@0 | 65 | for (var x of document.querySelectorAll("span")) |
michael@0 | 66 | log += x.id + ";"; |
michael@0 | 67 | is(log, "egg0;egg1;duckling1;egg2;egg3;", "for-of loop should work with a querySelectorAll() NodeList"); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | /* All the tests run twice. First, in this document, so without any wrappers. */ |
michael@0 | 71 | runTestsForDocument(document, ""); |
michael@0 | 72 | |
michael@0 | 73 | /* And once using the document of an iframe, so working with cross-compartment wrappers. */ |
michael@0 | 74 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 75 | function iframeLoaded(iframe) { |
michael@0 | 76 | runTestsForDocument(iframe.contentWindow.document, " (in iframe)"); |
michael@0 | 77 | SimpleTest.finish(); |
michael@0 | 78 | } |
michael@0 | 79 | |
michael@0 | 80 | </script> |
michael@0 | 81 | |
michael@0 | 82 | <iframe src="forOf_iframe.html" onload="iframeLoaded(this)"></iframe> |
michael@0 | 83 | |
michael@0 | 84 | </pre> |
michael@0 | 85 | </body> |
michael@0 | 86 | </html> |