1
0
Fork 0
firefox/docshell/test/navigation/frame_recursive_target.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

32 lines
883 B
HTML

<!DOCTYPE html>
<iframe id="static"></iframe>
<script>
const name = "frame_recursive_target";
const url = location.href;
const iframe = document.querySelector("iframe");
let isCrossOrigin = false;
try {
window.parent.location.hostname;
} catch (_) {
isCrossOrigin = true;
}
addEventListener("load", async () => {
await new Promise(resolve => {
iframe.addEventListener("load", resolve);
if (!isCrossOrigin) {
iframe.name = name;
}
iframe.src = url;
});
if (isCrossOrigin) {
const innerWin = iframe.contentWindow.document.querySelector("iframe");
await new Promise(resolve => {
innerWin.addEventListener("load", resolve);
window.open(url, name);
});
}
});
</script>