blob: 208ca7d64340b0ff9aecc8323def5a06f0b1c094 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../../editing.js"></script>
</head>
<body>
<div id="dropzone" style="width: 200px; height: 200px; background-color: grey;"></div>
<script>
description("Make sure that fileSystemDirectoryEntry.getFile() does not prevent a page from entering the back/forward cache.");
jsTestIsAsync = true;
restoredFromPageCache = false;
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");
restoredFromPageCache = 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();
} else {
entry.getFile('/testFiles/subfolder1/file3.txt', {}, function(file) {
testPassed("Success callback was called");
shouldBeTrue("restoredFromPageCache");
finishJSTest();
}, function(e) {
testFailed("Error callback was called");
finishJSTest();
});
}
}, false);
var dropzone = document.getElementById('dropzone');
dropzone.ondrop = function(e) {
e.preventDefault();
dataTransfer = e.dataTransfer;
entry = dataTransfer.items[0].webkitGetAsEntry();
window.location.href = "../../../fast/history/resources/page-cache-helper.html";
};
dropzone.ondragover = function(ev) {
ev.preventDefault();
}
onload = function() {
setTimeout(() => {
dragFilesOntoElement(dropzone, ['../../../fast/forms/file/entries-api/resources/testFiles']);
}, 0);
}
</script>
</body>
</html>