1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/test_bfcache.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 1.4 +<!-- 1.5 + Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ 1.7 +--> 1.8 +<html> 1.9 +<head> 1.10 + <title>Indexed Database Property Test</title> 1.11 + 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <script type="text/javascript"> 1.15 + function _runTest() { 1.16 + // Work around Win2k3 debug tinderboxes that may be too slow to complete this test. (Bug 614474) 1.17 + if (navigator.oscpu == "Windows NT 5.2") { 1.18 + todo(false, "Test disabled on (too slow debug) Windows 2003 (tinderboxes)"); 1.19 + 1.20 + finishTest(); 1.21 + return; 1.22 + } 1.23 + 1.24 + if (!SpecialPowers.isMainProcess()) { 1.25 + todo(false, "Test disabled in child processes, for now"); 1.26 + finishTest(); 1.27 + return; 1.28 + } 1.29 + 1.30 + runTest(); 1.31 + } 1.32 + </script> 1.33 + <script type="text/javascript;version=1.7"> 1.34 + var gOrigMaxTotalViewers = undefined; 1.35 + function setCachePref(enabled) { 1.36 + if (enabled) { 1.37 + is(typeof gOrigMaxTotalViewers, "undefined", 1.38 + "don't double-enable bfcache"); 1.39 + SpecialPowers.setBoolPref("browser.sessionhistory.cache_subframes", 1.40 + true); 1.41 + gOrigMaxTotalViewers = 1.42 + SpecialPowers.getIntPref("browser.sessionhistory.max_total_viewers"); 1.43 + SpecialPowers.setIntPref("browser.sessionhistory.max_total_viewers", 1.44 + 10); 1.45 + } 1.46 + else { 1.47 + is(typeof gOrigMaxTotalViewers, "number", 1.48 + "don't double-disable bfcache"); 1.49 + SpecialPowers.setIntPref("browser.sessionhistory.max_total_viewers", 1.50 + gOrigMaxTotalViewers); 1.51 + gOrigMaxTotalViewers = undefined; 1.52 + try { 1.53 + SpecialPowers.clearUserPref("browser.sessionhistory.cache_subframes"); 1.54 + } catch (e) { /* Pref didn't exist, meh */ } 1.55 + } 1.56 + } 1.57 + 1.58 + function testSteps() 1.59 + { 1.60 + var iframe = $("iframe"); 1.61 + setCachePref(true); 1.62 + window.onmessage = grabEventAndContinueHandler; 1.63 + 1.64 + iframe.src = "bfcache_iframe1.html"; 1.65 + var event = yield undefined; 1.66 + is(event.data, "go", "set up database successfully"); 1.67 + 1.68 + iframe.src = "bfcache_iframe2.html"; 1.69 + res = JSON.parse((yield).data); 1.70 + is(res.version, 2, "version was set correctly"); 1.71 + is(res.storeCount, 1, "correct set of stores"); 1.72 + ok(!("blockedFired" in res), "blocked shouldn't fire"); 1.73 + is(res.value, JSON.stringify({ hello: "world" }), 1.74 + "correct value found in store"); 1.75 + 1.76 + setCachePref(false); 1.77 + finishTest(); 1.78 + yield undefined; 1.79 + } 1.80 + </script> 1.81 + <script type="text/javascript;version=1.7" src="helpers.js"></script> 1.82 + 1.83 +</head> 1.84 + 1.85 +<body onload="_runTest();"> 1.86 + <iframe id="iframe"></iframe> 1.87 +</body> 1.88 + 1.89 +</html>