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=732209 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <meta charset="utf-8"> |
michael@0 | 8 | <title>Test for Bug 732209</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 | <style> |
michael@0 | 12 | #content span { color: red; } |
michael@0 | 13 | #content span.reverse { color: green; } |
michael@0 | 14 | #content { display: block !important; } |
michael@0 | 15 | #content span::before { content: attr(id); } |
michael@0 | 16 | </style> |
michael@0 | 17 | <link rel="stylesheet" href="bug732209-css.sjs?one"> |
michael@0 | 18 | <link rel="stylesheet" href="bug732209-css.sjs?two" crossorigin> |
michael@0 | 19 | <link rel="stylesheet" href="bug732209-css.sjs?three" crossorigin="use-credentials"> |
michael@0 | 20 | <link rel="stylesheet" |
michael@0 | 21 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?four"> |
michael@0 | 22 | <link rel="stylesheet" |
michael@0 | 23 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?five" |
michael@0 | 24 | crossorigin> |
michael@0 | 25 | <link rel="stylesheet" |
michael@0 | 26 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?six" |
michael@0 | 27 | crossorigin="use-credentials"> |
michael@0 | 28 | <link rel="stylesheet" |
michael@0 | 29 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?seven&cors-anonymous"> |
michael@0 | 30 | <link rel="stylesheet" id="cross-origin-sheet" |
michael@0 | 31 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?eight&cors-anonymous" |
michael@0 | 32 | crossorigin> |
michael@0 | 33 | <link rel="stylesheet" |
michael@0 | 34 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?nine&cors-anonymous" |
michael@0 | 35 | crossorigin="use-credentials"> |
michael@0 | 36 | <link rel="stylesheet" |
michael@0 | 37 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?ten&cors-credentials"> |
michael@0 | 38 | <link rel="stylesheet" |
michael@0 | 39 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?eleven&cors-credentials" |
michael@0 | 40 | crossorigin> |
michael@0 | 41 | <link rel="stylesheet" |
michael@0 | 42 | href="http://example.com/tests/layout/style/test/bug732209-css.sjs?twelve&cors-credentials" |
michael@0 | 43 | crossorigin="use-credentials"> |
michael@0 | 44 | </head> |
michael@0 | 45 | <body> |
michael@0 | 46 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=732209">Mozilla Bug 732209</a> |
michael@0 | 47 | <p id="display"></p> |
michael@0 | 48 | <div id="content" style="display: none"> |
michael@0 | 49 | <span id="one"></span> |
michael@0 | 50 | <span id="two"></span> |
michael@0 | 51 | <span id="three"></span> |
michael@0 | 52 | <span id="four"></span> |
michael@0 | 53 | <span id="five" class="reverse"></span> |
michael@0 | 54 | <span id="six" class="reverse"></span> |
michael@0 | 55 | <span id="seven"></span> |
michael@0 | 56 | <span id="eight"></span> |
michael@0 | 57 | <span id="nine" class="reverse"></span> |
michael@0 | 58 | <span id="ten"></span> |
michael@0 | 59 | <span id="eleven"></span> |
michael@0 | 60 | <span id="twelve"></span> |
michael@0 | 61 | </div> |
michael@0 | 62 | <pre id="test" style="color: red"> |
michael@0 | 63 | <script type="application/javascript"> |
michael@0 | 64 | |
michael@0 | 65 | /** Test for Bug 732209 **/ |
michael@0 | 66 | |
michael@0 | 67 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 68 | addLoadEvent(function() { |
michael@0 | 69 | var spans = $("content").querySelectorAll("span"); |
michael@0 | 70 | for (var i = 0; i < spans.length; ++i) { |
michael@0 | 71 | is(getComputedStyle(spans[i], "").color, "rgb(0, 128, 0)", |
michael@0 | 72 | "Span " + spans[i].id + " should be green"); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | try { |
michael@0 | 76 | var sheet = $("cross-origin-sheet").sheet; |
michael@0 | 77 | dump('aaa'); |
michael@0 | 78 | is(sheet.cssRules.length, 2, |
michael@0 | 79 | "Should be able to get length of list of rules"); |
michael@0 | 80 | is(sheet.cssRules[0].style.color, "green", |
michael@0 | 81 | "Should be able to read individual rules"); |
michael@0 | 82 | } catch (e) { |
michael@0 | 83 | ok(false, |
michael@0 | 84 | "Should be allowed to access cross-origin sheet that opted in with CORS: " + e); |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | SimpleTest.finish(); |
michael@0 | 88 | }); |
michael@0 | 89 | |
michael@0 | 90 | |
michael@0 | 91 | |
michael@0 | 92 | </script> |
michael@0 | 93 | </pre> |
michael@0 | 94 | </body> |
michael@0 | 95 | </html> |