test_bug450876.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  8. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  9. </head>
  10. <body>
  11. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450876">Mozilla Bug 450876</a>
  12. <p id="display"><a href="#" id="a">link to focus from</a><img usemap="#a" tabindex="1"></p>
  13. <div id="content" style="display: none">
  14. </div>
  15. <pre id="test">
  16. <script class="testbody" type="text/javascript">
  17. /** Test for Bug 450876 **/
  18. function doTest() {
  19. is(document.activeElement, document.body, "body element should be focused");
  20. document.getElementById('a').focus();
  21. is(document.activeElement, document.getElementById('a'), "link should have focus");
  22. is(document.hasFocus(), true, "document should be focused");
  23. SpecialPowers.DOMWindowUtils.sendKeyEvent('keypress', 9, 0, 0);
  24. is(document.activeElement, document.getElementById('a'), "body element should be focused");
  25. is(document.hasFocus(), false, "document should not be focused");
  26. SimpleTest.finish();
  27. }
  28. SimpleTest.waitForExplicitFinish();
  29. addLoadEvent(doTest);
  30. </script>
  31. </pre>
  32. </body>
  33. </html>