fune/docshell/test/navigation/file_meta_refresh.html
Olli Pettay dc0a4c5e6c Bug 1697564 - Suspend/resume refresh URI list when bfcache lives in the parent process, r=peterv
The old setup is a tad fragile since it relies on Stop to happen at a particular moment.

The name RefreshURIToQueue is just trying to be consistent with RefreshURIFromQueue

Differential Revision: https://phabricator.services.mozilla.com/D107930
2021-03-21 21:46:25 +00:00

40 lines
1.3 KiB
HTML

<html>
<head>
</head>
<body>
<script>
function addMetaRefresh() {
// eslint-disable-next-line no-unsanitized/property
document.head.innerHTML = "<meta http-equiv='refresh' content='5; url=" +
location.href.replace("?initial", "?refresh") + "'>";
}
onpageshow = function() {
let bc = new BroadcastChannel("test_meta_refresh");
bc.onmessage = function(event) {
if (event.data == "loadnext") {
bc.close();
addMetaRefresh();
location.href = location.href.replace("?initial", "?nextpage");
} else if (event.data == "back") {
bc.close();
history.back();
} else if (event.data == "ensuremetarefresh") {
bc.close();
// This test is designed to work with and without bfcache, but
// if bfcache is enabled, meta refresh should be suspended/resumed.
if (document.head.firstChild.localName != "meta") {
addMetaRefresh();
}
} else if (event.data == "close") {
bc.postMessage("closed");
bc.close();
window.close();
}
};
bc.postMessage({ load: location.search.substr(1) });
}
</script>
</body>
</html>