testing/web-platform/tests/focus/support/iframe-focuses-parent-same-site-outer.html
author Cosmin Sabou <csabou@mozilla.com>
Sat, 12 Jul 2025 09:18:08 +0300 (7 hours ago)
changeset 796290 5ad1f0c58c82bdfa2f42fed870bbe143465398d0
parent 563521 d2c7360e9d010e61e0a1060e6e74fc5afb2fd0e4
permissions -rw-r--r--
Revert "Bug 1977019 - re-enable hw video decoding testing. r=media-playback-reviewers,jolin" for causing win mda failures on test_hw_video_decoding.html This reverts commit 158474bdc0cf585b701bc47921f0a7d84f7bb84d.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>iframe focuses parent same site outer</title>
</head>
<body>
<iframe src="iframe-focuses-parent-same-site-inner.html"></iframe>
<script>
var w = null;
var focusDisallowed = false;
var failed = false;
window.onmessage = function(e) {
    if (failed) {
        return;
    }
    if (e.data == "ready") {
        focusDisallowed = true;
        document.getElementsByTagName("iframe")[0].contentWindow.postMessage("focus", "*");
        return;
    }
    focusDisallowed = false;
    if (w) {
        w.close();
        w = null;
    }
    opener.postMessage(failed ? "FAIL" : "PASS", "*");
}
window.onload = function() {
    w = window.open("iframe-focuses-parent-same-site-other.html");
}
document.body.onfocus = function() {
    if (focusDisallowed) {
        failed = true;
    }
}
</script>
</body>
</html>