blob: 83a48e303d19cab0e8facf3cbde2fac12155e663 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<!DOCTYPE html>
<html>
<head>
<title>focus() from next tick before iframe loaded different site</title>
</head>
<body>
<script>
var pendingTimeout = false;
window.onmessage = function(e) {
if (e.data == "tick") {
iframe.focus();
if (document.activeElement != iframe) {
if (pendingTimeout) {
clearTimeout(pendingTimeout);
}
pendingTimeout = true;
opener.postMessage("FAIL activeElement", "*");
}
return;
}
if (e.data == "onload") {
if (pendingTimeout) {
return;
}
pendingTimeout = opener.step_timeout(function() {
opener.postMessage("FAIL missing onfocus", "*");
}, 2000);
return;
}
if (pendingTimeout) {
clearTimeout(pendingTimeout);
}
pendingTimeout = true;
if (e.data == "onfocus") {
// Test not upstreamed, because this even is a Firefoxism
// https://github.com/whatwg/html/issues/6209
opener.postMessage("PASS", "*");
return;
}
opener.postMessage("FAIL " + e.data, "*");
}
var iframe = document.createElement("iframe");
iframe.src = "http://{{hosts[alt][www]}}:{{ports[http][0]}}/_mozilla/focus/support/focus-next-tick-before-iframe-loaded-different-site-inner.html";
document.body.appendChild(iframe);
window.postMessage("tick", "*");
</script>
</body>
</html>
|