test_bug450876.html (1485B)
1 <html> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=450876 4 --> 5 <head> 6 <title>Test for Bug 450876 - Crash [@ nsEventStateManager::GetNextTabbableMapArea] with img usemap and tabindex</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <script src="/tests/SimpleTest/EventUtils.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=450876">Mozilla Bug 450876</a> 13 <p id="display"><a href="#" id="a">link to focus from</a><img usemap="#a" tabindex="1"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 18 <pre id="test"> 19 <script class="testbody" type="text/javascript"> 20 21 /** Test for Bug 450876 */ 22 23 function setTabFocus() { 24 // Override tab focus behavior on Mac */ 25 SpecialPowers.pushPrefEnv({ set: [[ "accessibility.tabfocus", 7 ]] }, doTest); 26 } 27 28 function doTest() { 29 is(document.activeElement, document.body, "body element should be focused"); 30 document.getElementById('a').focus(); 31 is(document.activeElement, document.getElementById('a'), "link should have focus"); 32 is(document.hasFocus(), true, "document should be focused"); 33 synthesizeKey("KEY_Tab"); 34 is(document.activeElement, document.body, "body element should be focused"); 35 is(document.hasFocus(), false, "document should not be focused"); 36 37 SimpleTest.finish(); 38 } 39 40 SimpleTest.waitForExplicitFinish(); 41 addLoadEvent(setTabFocus); 42 43 </script> 44 </pre> 45 </body> 46 </html>