dom/events/test/test_bug450876.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/events/test/test_bug450876.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +<html>
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=450876
     1.7 +-->
     1.8 +<head>
     1.9 +  <title>Test for Bug 450876 - Crash [@ nsEventStateManager::GetNextTabbableMapArea] with img usemap and tabindex</title>
    1.10 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.11 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.12 +</head>
    1.13 +<body>
    1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450876">Mozilla Bug 450876</a>
    1.15 +<p id="display"><a href="#" id="a">link to focus from</a><img usemap="#a" tabindex="1"></p>
    1.16 +<div id="content" style="display: none">
    1.17 +  
    1.18 +</div>
    1.19 +
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +
    1.23 +/** Test for Bug 450876 **/
    1.24 +
    1.25 +function doTest() {
    1.26 +  is(document.activeElement, document.body, "body element should be focused");
    1.27 +  document.getElementById('a').focus();
    1.28 +  is(document.activeElement, document.getElementById('a'), "link should have focus");
    1.29 +  is(document.hasFocus(), true, "document should be focused");
    1.30 +  SpecialPowers.DOMWindowUtils.sendKeyEvent('keypress',  9, 0, 0);
    1.31 +  is(document.activeElement, document.getElementById('a'), "body element should be focused");
    1.32 +  is(document.hasFocus(), false, "document should not be focused");
    1.33 +
    1.34 +  SimpleTest.finish();
    1.35 +}
    1.36 +
    1.37 +SimpleTest.waitForExplicitFinish();
    1.38 +addLoadEvent(doTest);
    1.39 +
    1.40 +</script>
    1.41 +</pre>
    1.42 +</body>
    1.43 +</html>
    1.44 +

mercurial