blob: 9815a0457905d7ffbf2c5c0c3655afcb927f966b [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script src="/js-test-resources/js-test.js"></script>
<script>
description('Tests that a page with a loading iframe that has a pending XHR is able to enter the back/forward cache.');
window.jsTestIsAsync = true;
window.addEventListener("pageshow", function(event) {
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (event.persisted) {
testPassed("Page did enter and was restored from the page cache");
iframe.contentWindow.shouldFinishJSOnXHRLoad = true;
}
}, false);
window.addEventListener("pagehide", function(event) {
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
if (!event.persisted) {
testFailed("Page did not enter the page cache.");
finishJSTest();
}
}, false);
function navigate()
{
window.location.href = "/navigation/resources/page-cache-helper.html";
}
window.addEventListener('load', function() {
setTimeout(function() {
iframe = document.createElement("iframe");
iframe.src = "/navigation/resources/page-cache-xhr-in-loading-iframe.html";
document.body.appendChild(iframe);
}, 0);
}, false);
</script>
</body>
</html>