iframe-contentwindow-focus-with-different-site-intermediate-frame-middle.sub.html (1289B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>iframe.contentWindow.focus() with different-site intermediate frame middle</title> 4 <iframe allow="focus-without-user-activation" src="http://{{hosts[][www]}}:{{ports[http][0]}}/focus/support/iframe-contentwindow-focus-with-different-site-intermediate-frame-inner.html"></iframe> 5 <script> 6 let iframe = document.getElementsByTagName("iframe")[0]; 7 let log = ""; 8 function getLog() { 9 return log; 10 } 11 window.onmessage = function(e) { 12 log += e.data; 13 if (e.data == "starttest;") { 14 log += "middleactivelement:" + document.activeElement.localName + ";"; 15 log += "callfocus;"; 16 iframe.contentWindow.focus(); 17 log += "middleactivelement:" + document.activeElement.localName + ";"; 18 setTimeout(function() { 19 log += "middletimer;middleactivelement:" + document.activeElement.localName + ";"; 20 parent.postMessage(getLog(), "*"); 21 }, 1500); 22 } 23 }; 24 /* 25 * TODO: Get browsers to agree on this one. 26 * 27 * Does not fire in Firefox without Fission 28 * https://bugzilla.mozilla.org/show_bug.cgi?id=1675484 29 * 30 * Fires in Blink in the iframe.focus() case but not in 31 * the iframe.contentWindow.focus() case. 32 */ 33 // iframe.onfocus = function() { 34 // log += "middlefocus;"; 35 // } 36 37 </script>