test_bug601030.html (1536B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=601030 5 --> 6 <head> 7 <title>Test for Bug 601030</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=601030">Mozilla Bug 601030</a> 13 <p id="display"></p> 14 <div id="content"> 15 <iframe src="data:text/html,<input autofocus>"></iframe> 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 601030 */ 21 22 SimpleTest.waitForExplicitFinish(); 23 addLoadEvent(function() { 24 var f = document.createElement("iframe"); 25 var content = document.getElementById('content'); 26 27 f.addEventListener("load", function() { 28 SimpleTest.executeSoon(function() { 29 isnot(document.activeElement, f, 30 "autofocus should not work when another frame is inserted in the document"); 31 32 content.removeChild(f); 33 content.removeChild(document.getElementsByTagName('iframe')[0]); 34 f = document.createElement('iframe'); 35 f.addEventListener("load", function() { 36 isnot(document.activeElement, f, 37 "autofocus should not work in a frame if the top document is already loaded"); 38 SimpleTest.finish(); 39 }, {once: true}); 40 f.src = "data:text/html,<input autofocus>"; 41 content.appendChild(f); 42 }); 43 }, {once: true}); 44 45 f.src = "data:text/html,<input autofocus>"; 46 content.appendChild(f); 47 }); 48 49 </script> 50 </pre> 51 </body> 52 </html>