blob: 9eb6a123ccb8fbb5117c58f9d1d6110beeb0541b [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="/resources/js-test-pre.js"></script>
<script>
description("A frame in provisional load stage should prevent page caching.");
window.jsTestIsAsync = true;
if (window.testRunner)
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
window.addEventListener("pageshow", function(event) {
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (!window.sessionStorage.page_cache_provisional_load_test_started)
return;
delete window.sessionStorage.page_cache_provisional_load_test_started;
if (event.persisted)
testFailed("Page was restored from PageCache");
else
testPassed("Page was not restored from PageCache");
finishJSTest();
}, false);
window.addEventListener("pagehide", function(event) {
testFailed("pagehide - Page went into PageCache");
}, false);
function loadSubframeAndNavigateAway()
{
window.sessionStorage.page_cache_provisional_load_test_started = true;
// Force a back navigation back to this page after the subframe starts provisional navigation.
var testFrame = document.getElementById("testFrame");
testFrame.onbeforeunload = function() {
setTimeout(function() {
window.location.href = "resources/page-cache-helper.html";
}, 0);
};
testFrame.src = "http://127.0.0.1:8000/navigation/resources/slow-resource.pl?delay=3000";
}
window.addEventListener('load', loadSubframeAndNavigateAway, false);
</script>
<iframe id="testFrame" src="about:blank"></iframe>
<script src="/resources/js-test-post.js"></script>
</body>
</html>