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