diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /browser/base/content/test/outOfProcess | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/outOfProcess')
-rw-r--r-- | browser/base/content/test/outOfProcess/browser_controller.js | 54 |
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); |