commit 09ac29fea7086c070b03270ae60f3f5cb56ea545
parent 9812cb264720210ab5728332161938cbc8be5eba
Author: Cristina Horotan <chorotan@mozilla.com>
Date: Mon, 24 Nov 2025 08:10:13 +0200
Revert "Bug 1905212 - Allow less flickering in the performance tests, don't render the sidebar launcher when hidden. r=nsharpley" for causing xpcshell failures on test_sidebar_state.js
This reverts commit f61b5e1399343fb32bfc6c0a44236d69483de02c.
Diffstat:
6 files changed, 26 insertions(+), 69 deletions(-)
diff --git a/browser/base/content/test/performance/browser.toml b/browser/base/content/test/performance/browser.toml
@@ -16,6 +16,8 @@ prefs = [
# For perfomance tests do not enable the remote control cue, which gets set
# when Marionette is enabled, but users normally don't see.
"browser.chrome.disableRemoteControlCueForTests=true",
+ # Need to keep the revamped sidebar off until Bug 1905212 is done
+ "sidebar.revamp=false",
]
support-files = ["head.js"]
diff --git a/browser/base/content/test/performance/head.js b/browser/base/content/test/performance/head.js
@@ -1016,7 +1016,7 @@ async function checkLoadedScripts({
// window for some reason. See bug 1445161. This function allows to deal with
// that in a central place.
function isLikelyFocusChange(rects, frame) {
- if (rects.length >= 3 && rects.every(r => r.y2 < 100)) {
+ if (rects.length > 3 && rects.every(r => r.y2 < 100)) {
// There are at least 4 areas that changed near the top of the screen.
// Note that we need a bit more leeway than the titlebar height, because on
// OSX other toolbarbuttons in the navigation toolbar also get disabled
diff --git a/browser/components/customizableui/test/browser_sidebar_toggle.js b/browser/components/customizableui/test/browser_sidebar_toggle.js
@@ -13,19 +13,6 @@ registerCleanupFunction(async function () {
}
});
-async function ensureSidebarLauncherIsVisible() {
- await TestUtils.waitForTick();
- // Show the sidebar launcher if its hidden
- if (SidebarController.sidebarContainer.hidden) {
- document.getElementById("sidebar-button").doCommand();
- }
- await TestUtils.waitForTick();
- Assert.ok(
- BrowserTestUtils.isVisible(SidebarController.sidebarMain),
- "Sidebar launcher is visible"
- );
-}
-
var showSidebar = async function (win = window) {
let button = win.document.getElementById("sidebar-button");
let sidebarFocusedPromise = BrowserTestUtils.waitForEvent(
@@ -81,7 +68,7 @@ add_task(async function () {
await hideSidebar();
} else {
const sidebar = document.querySelector("sidebar-main");
- await ensureSidebarLauncherIsVisible();
+ ok(sidebar, "Sidebar is shown.");
for (const [index, toolButton] of sidebar.toolButtons.entries()) {
await SidebarController.toggle(toolButton.getAttribute("view"));
is(
diff --git a/browser/components/sidebar/SidebarState.sys.mjs b/browser/components/sidebar/SidebarState.sys.mjs
@@ -468,7 +468,6 @@ export class SidebarState {
this.#launcherEverVisible = true;
}
this.#launcherContainerEl.hidden = !visible;
- this.#launcherEl.requestUpdate();
this.#updateTabbrowser(visible);
this.#sidebarBoxEl.style.paddingInlineStart =
this.panelOpen && !visible ? "var(--space-small)" : "unset";
diff --git a/browser/components/sidebar/sidebar-main.mjs b/browser/components/sidebar/sidebar-main.mjs
@@ -776,11 +776,6 @@ export default class SidebarMain extends MozLitElement {
);
}
- shouldUpdate() {
- const container = window.SidebarController.sidebarContainer;
- return container && !container.hidden;
- }
-
render() {
/* Add 1 to tools and extensions count for "Customize sidebar" option */
let enabledToolsAndExtensionsCount =
diff --git a/browser/components/sidebar/tests/browser/browser_a11y_sidebar.js b/browser/components/sidebar/tests/browser/browser_a11y_sidebar.js
@@ -55,7 +55,6 @@ function isActiveElement(el) {
add_task(async function test_keyboard_navigation() {
const sidebar = document.querySelector("sidebar-main");
- let promisePanelFocused;
info("Waiting for tool buttons to be present");
await BrowserTestUtils.waitForMutationCondition(
sidebar,
@@ -86,80 +85,55 @@ add_task(async function test_keyboard_navigation() {
);
ok(isActiveElement(toolButtons[1]), "Second tool button is focused.");
- // 2nd tool is synced tabs which is a less-moving target than the chat panel
+ info("Press Arrow Up key.");
+ EventUtils.synthesizeKey("KEY_ArrowUp", {});
+ ok(isActiveElement(toolButtons[0]), "First tool button is focused.");
+
info("Press Enter key.");
- promisePanelFocused = BrowserTestUtils.waitForEvent(window, "SidebarFocused");
EventUtils.synthesizeKey("KEY_Enter", {});
- await promisePanelFocused;
- await SidebarController.waitUntilStable();
-
+ await sidebar.updateComplete;
ok(sidebar.open, "Sidebar is open.");
- ok(
- isActiveElement(SidebarController.browser),
- "The focus moved to the sidebar panel browser"
- );
-
- info("selectedView is:" + sidebar.selectedView);
is(
sidebar.selectedView,
- toolButtons[1].getAttribute("view"),
- "Sidebar is showing the 2nd tool."
+ toolButtons[0].getAttribute("view"),
+ "Sidebar is showing the first tool."
);
// Moz-button is passing an "aria-pressed" attribute to the actual buttonEl:
is(
- toolButtons[1].buttonEl.getAttribute("aria-pressed"),
+ toolButtons[0].buttonEl.getAttribute("aria-pressed"),
"true",
"aria-pressed is true for the active tool button."
);
is(
- toolButtons[0].buttonEl.getAttribute("aria-pressed"),
+ toolButtons[1].buttonEl.getAttribute("aria-pressed"),
"false",
"aria-pressed is false for the inactive tool button."
);
- info("Press Shift+tab to move focus to the close button in the panel");
- EventUtils.synthesizeKey("KEY_Tab", { shiftKey: true }, window);
-
- info("Press Enter key to click the panel close button.");
- let panelClosedPromise = BrowserTestUtils.waitForEvent(
- SidebarController._box,
- "sidebar-hide"
- );
+ info("Press Enter key again.");
EventUtils.synthesizeKey("KEY_Enter", {});
- await panelClosedPromise;
- await SidebarController.waitUntilStable();
- ok(
- isActiveElement(gBrowser.selectedBrowser),
- "The focus moved to the selected browser when the panel closed"
- );
-
- ok(!sidebar.open, "Sidebar panel is closed.");
+ await sidebar.updateComplete;
+ ok(!sidebar.open, "Sidebar is closed.");
is(
- toolButtons[1].buttonEl.getAttribute("aria-pressed"),
+ toolButtons[0].buttonEl.getAttribute("aria-pressed"),
"false",
"Tool is no longer active, aria-pressed becomes false."
);
- // We seem to need to wait here before re-focusing the tool button
- await waitForRepaint();
- info("Re-focus the first tool button");
- sidebar.buttonGroup.activeChild = toolButtons[0];
- toolButtons[0].focus();
- await SidebarController.waitUntilStable();
-
const customizeButton = sidebar.customizeButton;
+ toolButtons[0].focus();
- info(
- "Press Tab key to the next control group - which should be the customize button"
- );
+ info("Press Tab key.");
EventUtils.synthesizeKey("KEY_Tab", {});
ok(isActiveElement(customizeButton), "Customize button is focused.");
-
- info("Press Enter key to open the customize panel");
- promisePanelFocused = BrowserTestUtils.waitForEvent(window, "SidebarFocused");
+ info("Press Enter key again.");
+ const promiseFocused = BrowserTestUtils.waitForEvent(
+ window,
+ "SidebarFocused"
+ );
EventUtils.synthesizeKey("KEY_Enter", {});
- await promisePanelFocused;
- await SidebarController.waitUntilStable();
+ await promiseFocused;
+ await sidebar.updateComplete;
ok(sidebar.open, "Sidebar is open.");
let customizeDocument = SidebarController.browser.contentDocument;