diff options
Diffstat (limited to 'testing/web-platform/mozilla/tests/focus/support/focus-next-tick-before-iframe-loaded-different-site-outer.sub.html')
-rw-r--r-- | testing/web-platform/mozilla/tests/focus/support/focus-next-tick-before-iframe-loaded-different-site-outer.sub.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/focus/support/focus-next-tick-before-iframe-loaded-different-site-outer.sub.html b/testing/web-platform/mozilla/tests/focus/support/focus-next-tick-before-iframe-loaded-different-site-outer.sub.html new file mode 100644 index 0000000000..83a48e303d --- /dev/null +++ b/testing/web-platform/mozilla/tests/focus/support/focus-next-tick-before-iframe-loaded-different-site-outer.sub.html @@ -0,0 +1,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> |