summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_object_nav.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html/test/test_object_nav.html')
-rw-r--r--dom/html/test/test_object_nav.html97
1 files changed, 97 insertions, 0 deletions
diff --git a/dom/html/test/test_object_nav.html b/dom/html/test/test_object_nav.html
new file mode 100644
index 0000000000..02649fc125
--- /dev/null
+++ b/dom/html/test/test_object_nav.html
@@ -0,0 +1,97 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=720130
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 720130</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=720130">Mozilla Bug 720130</a>
+<p id="display"></p>
+<div id="content">
+ <input>
+ <object data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
+ <button>foo</button>
+ <object type="application/x-shockwave-flash"></object>
+ <object tabindex='0' type="application/x-shockwave-flash"></object>
+ <object data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
+ <object tabindex='0' data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAATklEQVRYhe3SIQ4AIBADwf7/04elBAtrVlSduGnSTDJ7cuT1PQJwwO+Hl7sAGAA07gjAAfgIBeAAoHFHAA7ARygABwCNOwJwAD5CATRgAYXh+kypw86nAAAAAElFTkSuQmCC"></object>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 720130 **/
+
+var gFocusCount = 0;
+var gFocusNb = 4;
+
+/**
+ * Check the focus navigation.
+ */
+function checkFocus() {
+ switch (gFocusCount) {
+ case 0:
+ is(document.activeElement, document.getElementsByTagName('a')[0],
+ "first focused element should be the link");
+ break;
+ case 1:
+ is(document.activeElement, document.getElementsByTagName('input')[0],
+ "second focused element should be the text field");
+ break;
+ case 2:
+ is(document.activeElement, document.getElementsByTagName('button')[0],
+ "third focused element should be the button");
+ break;
+ case 3:
+ ok(document.activeElement != document.getElementsByTagName('object')[1],
+ "fourth focused element should not be the plugin object");
+ ok(document.activeElement != document.getElementsByTagName('object')[2],
+ "fourth focused element should not be the plugin object with tabindex");
+ ok(document.activeElement != document.getElementsByTagName('object')[3],
+ "fourth focused element should not be the image object without tabindex");
+ is(document.activeElement, document.getElementsByTagName('object')[4],
+ "fourth focused element should be the image object with tabindex");
+ break;
+ }
+
+ gFocusCount++;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function doTest() {
+ is(document.activeElement, document.body);
+
+ // Preliminary check: tabindex should be 0 on the object.
+ is(document.getElementsByTagName('object')[0].tabIndex, 0,
+ "the element shouldn't get focus while navigating in the document");
+
+ document.addEventListener("focus", function() {
+ checkFocus();
+
+ if (gFocusCount != gFocusNb) {
+ synthesizeKey("KEY_Tab");
+ return;
+ }
+
+ document.removeEventListener("focus", arguments.callee, true);
+ SimpleTest.finish();
+ }, true);
+
+ synthesizeKey("KEY_Tab");
+}
+
+SimpleTest.waitForFocus(function () {
+ // Set the focus model so that links are focusable by the tab key even on Mac
+ SpecialPowers.pushPrefEnv({'set': [['accessibility.tabfocus', 7]]}, doTest);
+});
+
+</script>
+</pre>
+</body>
+</html>