blob: 48fbf6fc1314b1c99f9218215764633381ba88eb [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<img src="../dom/resources/abe.png">
<a id="testLink" style="display: none" href="resources/page-cache-helper.html">Link</a>
<iframe id="testFrame" src="about:blank"></iframe>
<script>
description('Tests that a page with an iframe that ran a JavaScript URL is able to enter the page cache.');
jsTestIsAsync = true;
window.addEventListener("pageshow", function(event) {
debug("pageshow - " + (event.persisted ? "" : "not ") + "from cache");
if (event.persisted) {
debug("PASS - Page did enter and was restored from the page cache");
finishJSTest();
}
});
window.addEventListener("pagehide", function(event) {
debug("pagehide - " + (event.persisted ? "" : "not ") + "entering cache");
if (!event.persisted) {
debug("FAIL - Page did not enter the page cache.");
finishJSTest();
}
});
window.addEventListener('load', function() {
setTimeout(() => {
document.getElementById("testFrame").contentWindow.location.replace("javascript:'foo';");
setTimeout(() => {
testLink.click();
}, 0);
}, 0);
});
</script>
</body>
</html>