focus-event-after-switching-iframes-inner.html (757B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Focus event inner document</title> 6 </head> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-actions.js"></script> 9 <body> 10 <h1>Inner</h1> 11 <script> 12 let innerlog = "innerlog:"; 13 14 window.onmessage = function(e) { 15 if (e.data == "getlog") { 16 parent.postMessage(innerlog, "*"); 17 } else if (e.data == "focus") { 18 test_driver.set_test_context(window.parent); 19 test_driver.click(document.body); 20 } 21 }; 22 23 window.onfocus = function() { 24 innerlog += "windowfocus,"; 25 parent.postMessage("focus", "*"); 26 }; 27 28 window.onblur = function() { 29 innerlog += "windowblur,"; 30 }; 31 32 window.onload = function() { 33 parent.postMessage("ready", "*"); 34 } 35 </script> 36 </body> 37 </html>