summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_object_plugin_nav.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/html/test/test_object_plugin_nav.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/html/test/test_object_plugin_nav.html')
-rw-r--r--dom/html/test/test_object_plugin_nav.html99
1 files changed, 99 insertions, 0 deletions
diff --git a/dom/html/test/test_object_plugin_nav.html b/dom/html/test/test_object_plugin_nav.html
new file mode 100644
index 000000000..91590e51a
--- /dev/null
+++ b/dom/html/test/test_object_plugin_nav.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=720130
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 720130</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="plugin-utils.js"></script>
+ <script type="application/javascript">
+ setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
+ </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 type="application/x-test"></object>
+ <button>foo</button>
+ <object tabindex='0' type="application/x-test"></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:
+ is(document.activeElement, document.getElementsByTagName('object')[1],
+ "fourth focused element should be the object");
+ break;
+ }
+
+ gFocusCount++;
+}
+
+SimpleTest.waitForExplicitFinish();
+
+function doTest() {
+ is(document.activeElement, document.body);
+
+ // Preliminary check: tabindex should be -1 on the object.
+ is(document.getElementsByTagName('object')[0].tabIndex, -1,
+ "the plugin shouldn't get focus while navigating in the document");
+
+ document.addEventListener("focus", function() {
+ checkFocus();
+
+ if (gFocusCount != gFocusNb) {
+ synthesizeKey("VK_TAB", {});
+ return;
+ }
+
+ document.removeEventListener("focus", arguments.callee, true);
+
+ // Just make sure that .focus() still works.
+ var o = document.getElementsByTagName('object')[0];
+ o.onfocus = function() {
+ SimpleTest.finish();
+ o.onfocus = null;
+ };
+ o.focus();
+ }, true);
+
+ synthesizeKey("VK_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>