summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/outOfProcess/browser_controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/outOfProcess/browser_controller.js')
-rw-r--r--browser/base/content/test/outOfProcess/browser_controller.js54
1 files changed, 39 insertions, 15 deletions
diff --git a/browser/base/content/test/outOfProcess/browser_controller.js b/browser/base/content/test/outOfProcess/browser_controller.js
index f9d9ca8c93..f3c0217b90 100644
--- a/browser/base/content/test/outOfProcess/browser_controller.js
+++ b/browser/base/content/test/outOfProcess/browser_controller.js
@@ -42,8 +42,19 @@ add_task(async function test_controllers_subframes() {
gURLBar.focus();
+ let canTabMoveFocusToRootElement = !SpecialPowers.getBoolPref(
+ "dom.disable_tab_focus_to_root_element"
+ );
for (let stepNum = 0; stepNum < browsingContexts.length; stepNum++) {
- await keyAndUpdate(stepNum > 0 ? "VK_TAB" : "VK_F6", {}, 6);
+ let useTab = stepNum > 0;
+ // When canTabMoveFocusToRootElement is true, this kepress will move the
+ // focus to a root element, which will trigger an extra "select" command
+ // compare to the case when canTabMoveFocusToRootElement is false.
+ await keyAndUpdate(
+ useTab ? "VK_TAB" : "VK_F6",
+ {},
+ canTabMoveFocusToRootElement ? 6 : 4
+ );
// Since focus may be switching into a separate process here,
// need to wait for the focus to have been updated.
@@ -59,22 +70,35 @@ add_task(async function test_controllers_subframes() {
goUpdateGlobalEditMenuItems(true);
}
- await SpecialPowers.spawn(browsingContexts[stepNum], [], () => {
- // Both the tab key and document navigation with F6 will focus
- // the root of the document within the frame.
- let document = content.document;
- Assert.equal(
- document.activeElement,
- document.documentElement,
- "root focused"
+ await SpecialPowers.spawn(
+ browsingContexts[stepNum],
+ [{ canTabMoveFocusToRootElement, useTab }],
+ args => {
+ // Both the tab key and document navigation with F6 will focus
+ // the root of the document within the frame.
+ // When dom.disable_tab_focus_to_root_element is true, only F6 will do this.
+ let document = content.document;
+ let expectedElement =
+ args.canTabMoveFocusToRootElement || !args.useTab
+ ? document.documentElement
+ : document.getElementById("input");
+ Assert.equal(document.activeElement, expectedElement, "root focused");
+ }
+ );
+
+ if (canTabMoveFocusToRootElement || !useTab) {
+ // XXX Currently, Copy is always enabled when the root (not an editor element)
+ // is focused. Possibly that should only be true if a listener is present?
+ checkCommandState(
+ "step " + stepNum + " root focused",
+ false,
+ true,
+ false
);
- });
- // XXX Currently, Copy is always enabled when the root (not an editor element)
- // is focused. Possibly that should only be true if a listener is present?
- checkCommandState("step " + stepNum + " root focused", false, true, false);
- // Tab to the textbox.
- await keyAndUpdate("VK_TAB", {}, 1);
+ // Tab to the textbox.
+ await keyAndUpdate("VK_TAB", {}, 1);
+ }
if (AppConstants.platform != "macosx") {
goUpdateGlobalEditMenuItems(true);