summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/focus/support/focus-already-focused-iframe-same-site-outer.html
blob: cc4efe85412337995d8f0040afac3f868c4616bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!doctype html>
<meta charset="utf-8">
<title>Focus already focused iframe</title>
<script>
let failed = false;
window.onmessage = function(e) {
    if (e.data == "focus") {
        document.getElementsByTagName("iframe")[0].focus();
        opener.step_timeout(function() {
            if (failed) {
                opener.postMessage("FAIL", "*");
            } else {
                opener.postMessage("PASS", "*");
            }
        }, 1500);
    } else if (e.data == "FAIL") {
        failed = true;
    }
}
</script>
<iframe src="focus-already-focused-iframe-inner.html"></iframe>