<!DOCTYPE html>
<html>
<head>
<script src="test_utils.js"></script>
<script>
function clickSameSiteNewWindowLink() {
const element = document.getElementById('same_site_new_window_link');
element.click();
}
function getSessionStorageKeys() {
const keys = [];
let txt = '';
for (let i = 0; i < sessionStorage.length; ++i) {
keys.push(sessionStorage.key(i));
}
keys.sort();
keys.forEach((key) => {
if (txt.length) {
txt += ', ';
}
txt += key;
});
return txt;
}
const params = new URLSearchParams(location.search);
const isPrerendering = params.has('prerendering');
if (isPrerendering) {
sessionStorage.setItem('prerendering', '1');
window.sessionKeysInPrerenderingchange = new Promise((resolve) => {
document.addEventListener('prerenderingchange', () => {
resolve(getSessionStorageKeys());
sessionStorage.setItem('activated', '1');
});
});
} else {
sessionStorage.setItem('initial', '1');
}
</script>
</head>
<body>
<a href="session_storage.html?prerendering=" id="same_site_new_window_link" target="_blank">same-site new window</a>
</body>
</html>