blob: 55963bcff449778a22e8107df9792c1f2226a172 [file] [log] [blame]
<!-- webkit-test-runner [ enableBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description('Tests that a page with an open WebDatabase that has pending transactions does not go into the page cache.');
window.jsTestIsAsync = true;
if (window.testRunner)
testRunner.clearAllDatabases();
window.addEventListener("pageshow", function(event) {
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (!window.sessionStorage.page_cache_open_webdatabase_test_started)
return;
delete window.sessionStorage.page_cache_open_webdatabase_test_started;
if (event.persisted)
testFailed("Page did enter and was restored from the page cache");
else
testPassed("Page was not restored from page cache");
finishJSTest();
}, false);
window.addEventListener("pagehide", function(event) {
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
if (event.persisted) {
testFailed("Page entered the page cache.");
finishJSTest();
}
}, false);
window.addEventListener('load', function() {
// Open the database.
db = openDatabase("PageCacheTest", "", "Page Cache Test", 32768);
db.transaction(function(tx) {
// Force a back navigation back to this page.
window.sessionStorage.page_cache_open_webdatabase_test_started = true;
window.location.href = "resources/page-cache-helper.html";
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
});
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS2 (id unique, log)');
});
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS3 (id unique, log)');
});
}, false);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>