Backed out changeset 24d23a09f65c (bug 1944910) for causing bc failures @ browser_newtabButton.js CLOSED TREE
This commit is contained in:
@@ -90,15 +90,6 @@ export class SidebarState {
|
||||
return this.#controller.sidebarContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sidebar panel element.
|
||||
*
|
||||
* @returns {XULElement}
|
||||
*/
|
||||
get #sidebarBoxEl() {
|
||||
return this.#controller._box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sidebar panel.
|
||||
*
|
||||
@@ -231,23 +222,9 @@ export class SidebarState {
|
||||
return this.#props.launcherVisible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the launcher `visible` and `expanded` states to handle the
|
||||
* following scenarios:
|
||||
*
|
||||
* - Toggling "Hide tabs and sidebar" from the customize panel.
|
||||
* - Clicking sidebar button from the toolbar.
|
||||
* - Removing sidebar button from the toolbar.
|
||||
* - Force expand value
|
||||
*
|
||||
* @param {boolean} visible
|
||||
* @param {boolean} onToolbarButtonClick
|
||||
* @param {boolean} onToolbarButtonRemoval
|
||||
* @param {boolean} forceExpandValue
|
||||
*/
|
||||
updateVisibility(
|
||||
visible,
|
||||
onToolbarButtonClick = false,
|
||||
openedByToolbarButton = false,
|
||||
onToolbarButtonRemoval = false,
|
||||
forceExpandValue = null
|
||||
) {
|
||||
@@ -264,18 +241,17 @@ export class SidebarState {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!openedByToolbarButton && !visible && this.panelOpen) {
|
||||
// no-op to handle the case when a user changes the visibility setting via the
|
||||
// customize panel, we don't want to close anything on them.
|
||||
return;
|
||||
}
|
||||
// we need this set to verticalTabsEnabled to ensure it has the correct state when toggling the sidebar button
|
||||
this.launcherExpanded = lazy.verticalTabsEnabled && visible;
|
||||
|
||||
if (!visible && this.panelOpen) {
|
||||
if (onToolbarButtonClick) {
|
||||
// Hiding the launcher with the toolbar button should also close out any open panels and resets panelOpen
|
||||
this.#controller.hide();
|
||||
} else {
|
||||
// Hide the launcher when the pref is set to hide-sidebar
|
||||
this.launcherVisible = false;
|
||||
this.#previousLauncherVisible = false;
|
||||
return;
|
||||
}
|
||||
// Hiding the launcher should also close out any open panels and resets panelOpen
|
||||
this.#controller.hide();
|
||||
}
|
||||
this.launcherVisible = visible;
|
||||
break;
|
||||
@@ -298,8 +274,6 @@ export class SidebarState {
|
||||
this.#props.launcherVisible = visible;
|
||||
this.#launcherContainerEl.hidden = !visible;
|
||||
this.#updateTabbrowser(visible);
|
||||
this.#sidebarBoxEl.style.paddingInlineStart =
|
||||
this.panelOpen && !visible ? "var(--space-small)" : "unset";
|
||||
}
|
||||
|
||||
get launcherExpanded() {
|
||||
|
||||
@@ -2008,13 +2008,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
if (SidebarController._state) {
|
||||
const isVerticalTabs = SidebarController.sidebarVerticalTabsEnabled;
|
||||
SidebarController._state.revampVisibility = newValue;
|
||||
if (
|
||||
SidebarController._animationEnabled &&
|
||||
!window.gReduceMotion &&
|
||||
newValue !== "expand-on-hover"
|
||||
) {
|
||||
SidebarController._animateSidebarMain();
|
||||
}
|
||||
SidebarController._state.updateVisibility(
|
||||
(newValue != "hide-sidebar" && isVerticalTabs) || !isVerticalTabs,
|
||||
false,
|
||||
|
||||
@@ -232,20 +232,12 @@ add_task(async function test_customize_visibility_setting() {
|
||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const panel = await showCustomizePanel(win);
|
||||
ok(!panel.visibilityInput.checked, "Always show is enabled by default.");
|
||||
ok(
|
||||
!win.SidebarController.sidebarContainer.hidden,
|
||||
"Launcher is shown by default."
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
panel.visibilityInput,
|
||||
{},
|
||||
win.SidebarController.browser.contentWindow
|
||||
);
|
||||
ok(panel.visibilityInput.checked, "Hide sidebar is enabled.");
|
||||
ok(
|
||||
win.SidebarController.sidebarContainer.hidden,
|
||||
"Launcher is hidden by default."
|
||||
);
|
||||
await deferredPrefChange.promise;
|
||||
const newPrefValue = Services.prefs.getStringPref(SIDEBAR_VISIBILITY_PREF);
|
||||
is(newPrefValue, "hide-sidebar", "Visibility preference updated.");
|
||||
@@ -253,10 +245,6 @@ add_task(async function test_customize_visibility_setting() {
|
||||
const newWin = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const newPanel = await showCustomizePanel(newWin);
|
||||
ok(newPanel.visibilityInput.checked, "Visibility setting persists.");
|
||||
ok(
|
||||
win.SidebarController.sidebarContainer.hidden,
|
||||
"Launcher is hidden by default in new window."
|
||||
);
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
await BrowserTestUtils.closeWindow(newWin);
|
||||
|
||||
@@ -16,11 +16,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
});
|
||||
|
||||
add_setup(async () => {
|
||||
// turn off animations for this test
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.animation.enabled", false]],
|
||||
});
|
||||
|
||||
SidebarController.init();
|
||||
await TestUtils.waitForTick();
|
||||
});
|
||||
|
||||
@@ -30,7 +30,7 @@ add_task(async function test_toggle_collapse_close_button() {
|
||||
|
||||
let newTabButton = document.getElementById("tabs-newtab-button");
|
||||
info("Open a new tab using the new tab button.");
|
||||
newTabButton.click();
|
||||
EventUtils.synthesizeMouseAtCenter(newTabButton, {});
|
||||
is(gBrowser.tabs.length, 2, "Tabstrip now has two tabs");
|
||||
|
||||
let firstTab = gBrowser.visibleTabs[0];
|
||||
@@ -49,8 +49,9 @@ add_task(async function test_toggle_collapse_close_button() {
|
||||
await TestUtils.waitForTick();
|
||||
|
||||
computedStyle = window.getComputedStyle(selectedTab);
|
||||
await TestUtils.waitForCondition(
|
||||
() => computedStyle.opacity == "1",
|
||||
is(
|
||||
computedStyle.opacity,
|
||||
"1",
|
||||
"The selected tab is showing the close button on hover."
|
||||
);
|
||||
|
||||
@@ -85,15 +86,18 @@ add_task(async function test_toggle_collapse_close_button() {
|
||||
computedStyle = window.getComputedStyle(
|
||||
firstTab.querySelector(".tab-close-button")
|
||||
);
|
||||
await TestUtils.waitForCondition(
|
||||
() => computedStyle.opacity == "1",
|
||||
is(
|
||||
computedStyle.opacity,
|
||||
"1",
|
||||
"The inactive tab is showing the close button on hover."
|
||||
);
|
||||
|
||||
// The tab can be closed via the keyboard shortcut, this button is not focusable
|
||||
AccessibilityUtils.setEnv({ focusableRule: false });
|
||||
// Close the active tab
|
||||
firstTab.querySelector(".tab-close-button").click();
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
firstTab.querySelector(".tab-close-button"),
|
||||
{}
|
||||
);
|
||||
AccessibilityUtils.resetEnv();
|
||||
is(gBrowser.tabs.length, 1, "Tabstrip now has one tab");
|
||||
|
||||
|
||||
@@ -3,13 +3,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
add_setup(async () => {
|
||||
// turn off animations for this test
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.animation.enabled", false]],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_sidebar_extension_context_menu() {
|
||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
await waitForBrowserWindowActive(win);
|
||||
|
||||
@@ -15,7 +15,10 @@ const { NonPrivateTabs } = ChromeUtils.importESModule(
|
||||
|
||||
add_setup(async () => {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.verticalTabs", false]],
|
||||
set: [
|
||||
["sidebar.verticalTabs", false],
|
||||
["sidebar.visibility", "always-show"],
|
||||
],
|
||||
});
|
||||
Services.telemetry.clearScalars();
|
||||
SessionStoreTestUtils.init(this, window);
|
||||
|
||||
Reference in New Issue
Block a user