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 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <html>
6 <head>
7 <title>Indexed Database Property Test</title>
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="text/javascript">
12 function _runTest() {
13 // Work around Win2k3 debug tinderboxes that may be too slow to complete this test. (Bug 614474)
14 if (navigator.oscpu == "Windows NT 5.2") {
15 todo(false, "Test disabled on (too slow debug) Windows 2003 (tinderboxes)");
17 finishTest();
18 return;
19 }
21 if (!SpecialPowers.isMainProcess()) {
22 todo(false, "Test disabled in child processes, for now");
23 finishTest();
24 return;
25 }
27 runTest();
28 }
29 </script>
30 <script type="text/javascript;version=1.7">
31 var gOrigMaxTotalViewers = undefined;
32 function setCachePref(enabled) {
33 if (enabled) {
34 is(typeof gOrigMaxTotalViewers, "undefined",
35 "don't double-enable bfcache");
36 SpecialPowers.setBoolPref("browser.sessionhistory.cache_subframes",
37 true);
38 gOrigMaxTotalViewers =
39 SpecialPowers.getIntPref("browser.sessionhistory.max_total_viewers");
40 SpecialPowers.setIntPref("browser.sessionhistory.max_total_viewers",
41 10);
42 }
43 else {
44 is(typeof gOrigMaxTotalViewers, "number",
45 "don't double-disable bfcache");
46 SpecialPowers.setIntPref("browser.sessionhistory.max_total_viewers",
47 gOrigMaxTotalViewers);
48 gOrigMaxTotalViewers = undefined;
49 try {
50 SpecialPowers.clearUserPref("browser.sessionhistory.cache_subframes");
51 } catch (e) { /* Pref didn't exist, meh */ }
52 }
53 }
55 function testSteps()
56 {
57 var iframe = $("iframe");
58 setCachePref(true);
59 window.onmessage = grabEventAndContinueHandler;
61 iframe.src = "bfcache_iframe1.html";
62 var event = yield undefined;
63 is(event.data, "go", "set up database successfully");
65 iframe.src = "bfcache_iframe2.html";
66 res = JSON.parse((yield).data);
67 is(res.version, 2, "version was set correctly");
68 is(res.storeCount, 1, "correct set of stores");
69 ok(!("blockedFired" in res), "blocked shouldn't fire");
70 is(res.value, JSON.stringify({ hello: "world" }),
71 "correct value found in store");
73 setCachePref(false);
74 finishTest();
75 yield undefined;
76 }
77 </script>
78 <script type="text/javascript;version=1.7" src="helpers.js"></script>
80 </head>
82 <body onload="_runTest();">
83 <iframe id="iframe"></iframe>
84 </body>
86 </html>