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.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=221428
5 -->
6 <head>
7 <title>Test for Bug 221428</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 <link rel="stylesheet" href="data:text/css,body { color: green; }">
11 <style>
12 @import url("data:text/css,body { border: 1px solid transparent; }");
13 body { color: black; }
14 </style>
15 <script>
16 var executed = false;
17 </script>
18 <link rel="stylesheet" href="javascript:executed = true;">
19 </head>
20 <body>
21 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=221428">Mozilla Bug 221428</a>
22 <p id="display"></p>
23 <div id="content" style="display: none">
25 </div>
26 <pre id="test">
27 <script class="testbody" type="text/javascript">
29 /** Test for Bug 221428 **/
31 var exceptionThrown = false;
32 try {
33 is(document.styleSheets[1].cssRules[0].cssText, "body { color: green; }",
34 "Should get the color: green rule back");
35 } catch (e) {
36 exceptionThrown = true;
37 }
39 ok(!exceptionThrown, "Should be able to access data: <link> stylesheet");
41 exceptionThrown = false;
42 try {
43 is(document.styleSheets[2].cssRules[1].cssText, "body { color: black; }",
44 "Should get the color: black rule back");
45 } catch (e) {
46 exceptionThrown = true;
47 }
48 ok(!exceptionThrown, "Should be able to access <style> stylesheet");
50 exceptionThrown = false;
51 try {
52 is(document.styleSheets[2].cssRules[0].styleSheet.cssRules[0].cssText,
53 "body { border: 1px solid transparent; }",
54 "Should get the 'border: 1px solid transparent' rule back");
55 } catch (e) {
56 exceptionThrown = true;
57 }
58 ok(!exceptionThrown, "Should be able to access data: @import stylesheet");
60 ok(!executed,
61 "Shouldn't be executing stylesheet-link javascript: URIs against " +
62 "the page context");
64 </script>
65 </pre>
66 </body>
67 </html>