Backed out changeset 0923d9bb2550 (bug 1944931) for causing bc failures @browser_reviewchecker_sidebar.js. CLOSED TREE
This commit is contained in:
@@ -20,15 +20,11 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
"sidebarBackupState",
|
||||
BACKUP_STATE_PREF
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
lazy,
|
||||
"verticalTabsEnabled",
|
||||
"sidebar.verticalTabs",
|
||||
false,
|
||||
(pref, oldVal, newVal) => {
|
||||
SidebarManager.handleVerticalTabsPrefChange(newVal);
|
||||
}
|
||||
false
|
||||
);
|
||||
|
||||
export const SidebarManager = {
|
||||
@@ -78,16 +74,7 @@ export const SidebarManager = {
|
||||
);
|
||||
});
|
||||
|
||||
this.handleVerticalTabsPrefChange(lazy.verticalTabsEnabled);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adjust for a change to the verticalTabs pref.
|
||||
*/
|
||||
handleVerticalTabsPrefChange(isEnabled) {
|
||||
if (isEnabled) {
|
||||
Services.prefs.setStringPref(VISIBILITY_SETTING_PREF, "always-show");
|
||||
} else {
|
||||
if (!lazy.verticalTabsEnabled) {
|
||||
Services.prefs.setStringPref(VISIBILITY_SETTING_PREF, "hide-sidebar");
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1852,11 +1852,12 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
"always-show",
|
||||
(_aPreference, _previousValue, newValue) => {
|
||||
if (!SidebarController.inPopup && !SidebarController.uninitializing) {
|
||||
const isVerticalTabs = SidebarController.sidebarVerticalTabsEnabled;
|
||||
SidebarController.recordVisibilitySetting(newValue);
|
||||
SidebarController._state.revampVisibility = newValue;
|
||||
SidebarController._state.updateVisibility(
|
||||
(newValue != "hide-sidebar" && isVerticalTabs) || !isVerticalTabs
|
||||
(newValue != "hide-sidebar" &&
|
||||
SidebarController.sidebarVerticalTabsEnabled) ||
|
||||
!SidebarController.sidebarVerticalTabsEnabled
|
||||
);
|
||||
SidebarController.updateToolbarButton();
|
||||
}
|
||||
@@ -1870,6 +1871,10 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
||||
(_aPreference, _previousValue, newValue) => {
|
||||
if (!SidebarController.uninitializing && !SidebarController.inPopup) {
|
||||
SidebarController.recordTabsLayoutSetting(newValue);
|
||||
Services.prefs.setStringPref(
|
||||
SidebarController.VISIBILITY_PREF,
|
||||
newValue ? "always-show" : "hide-sidebar"
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
|
||||
add_setup(async () => {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.verticalTabs", true]],
|
||||
set: [
|
||||
["sidebar.verticalTabs", true],
|
||||
["sidebar.visibility", "always-show"],
|
||||
],
|
||||
});
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"always-show",
|
||||
"Sanity check the visibilty pref when verticalTabs are enabled"
|
||||
);
|
||||
});
|
||||
registerCleanupFunction(async () => {
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
@@ -154,11 +154,6 @@ add_task(async function test_toggle_vertical_tabs_from_a_tab() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.verticalTabs", false]],
|
||||
});
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"hide-sidebar",
|
||||
"Sanity check the visibilty pref is updated when verticalTabs are disabled"
|
||||
);
|
||||
|
||||
info("Enable vertical tabs from a tab.");
|
||||
const tabContextMenu = document.getElementById("tabContextMenu");
|
||||
@@ -175,11 +170,6 @@ add_task(async function test_toggle_vertical_tabs_from_a_tab() {
|
||||
() => gBrowser.tabContainer.verticalMode,
|
||||
"Vertical tabs are enabled."
|
||||
);
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"always-show",
|
||||
"Sanity check the visibilty pref is updated when verticalTabs are enabled"
|
||||
);
|
||||
|
||||
info("Disable vertical tabs from a tab.");
|
||||
await openAndWaitForContextMenu(tabContextMenu, gBrowser.selectedTab, () => {
|
||||
@@ -194,11 +184,6 @@ add_task(async function test_toggle_vertical_tabs_from_a_tab() {
|
||||
() => !gBrowser.tabContainer.verticalMode,
|
||||
"Vertical tabs are disabled."
|
||||
);
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"hide-sidebar",
|
||||
"Sanity check the visibilty pref is updated when verticalTabs are disabled"
|
||||
);
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
@@ -207,11 +192,6 @@ add_task(async function test_toggle_vertical_tabs_from_tab_strip() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["sidebar.verticalTabs", false]],
|
||||
});
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"hide-sidebar",
|
||||
"Sanity check the visibilty pref when verticalTabs are disabled"
|
||||
);
|
||||
|
||||
info("Enable vertical tabs from the toolbar.");
|
||||
const toolbarContextMenu = document.getElementById("toolbar-context-menu");
|
||||
@@ -237,11 +217,6 @@ add_task(async function test_toggle_vertical_tabs_from_tab_strip() {
|
||||
() => gBrowser.tabContainer.verticalMode,
|
||||
"Vertical tabs are enabled."
|
||||
);
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"always-show",
|
||||
"Sanity check the visibilty pref when verticalTabs are enabled"
|
||||
);
|
||||
|
||||
// Open customize sidebar panel from context menu
|
||||
await openAndWaitForContextMenu(
|
||||
@@ -275,11 +250,6 @@ add_task(async function test_toggle_vertical_tabs_from_tab_strip() {
|
||||
() => !gBrowser.tabContainer.verticalMode,
|
||||
"Vertical tabs are disabled."
|
||||
);
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"hide-sidebar",
|
||||
"Sanity check the visibilty pref when verticalTabs are disabled"
|
||||
);
|
||||
|
||||
window.SidebarController.hide();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
@@ -169,11 +169,6 @@ add_task(async function test_flip_revamp_pref() {
|
||||
ok(BrowserTestUtils.isVisible(verticalTabs), "Vertical tabs slot is visible");
|
||||
|
||||
ok(sidebar, "Revamped sidebar is shown initially.");
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref("sidebar.visibility"),
|
||||
"always-show",
|
||||
"Sanity check the visibilty pref when verticalTabs are enabled"
|
||||
);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({ set: [["sidebar.revamp", false]] });
|
||||
|
||||
|
||||
@@ -19,14 +19,9 @@ add_setup(async () => {
|
||||
set: [
|
||||
[SIDEBAR_TAB_DIRECTION_PREF, true],
|
||||
[SIDEBAR_BUTTON_INTRODUCED_PREF, false],
|
||||
[SIDEBAR_VISIBILITY_PREF, "always-show"],
|
||||
],
|
||||
});
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref(SIDEBAR_VISIBILITY_PREF),
|
||||
"always-show",
|
||||
"Sanity check the visibilty pref when verticalTabs are enabled"
|
||||
);
|
||||
|
||||
let navbarDefaults = gAreas.get("nav-bar").get("defaultPlacements");
|
||||
let hadSavedState = !!CustomizableUI.getTestOnlyInternalProp("gSavedState");
|
||||
if (!hadSavedState) {
|
||||
@@ -184,13 +179,6 @@ add_task(async function test_states_for_hide_sidebar() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[SIDEBAR_TAB_DIRECTION_PREF, false]],
|
||||
});
|
||||
|
||||
Assert.equal(
|
||||
Services.prefs.getStringPref(SIDEBAR_VISIBILITY_PREF),
|
||||
"hide-sidebar",
|
||||
"Sanity check the visibilty pref when verticalTabs are disabled"
|
||||
);
|
||||
|
||||
const win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
const { SidebarController } = win;
|
||||
const { sidebarContainer, sidebarMain, toolbarButton } = SidebarController;
|
||||
@@ -233,8 +221,12 @@ add_task(async function test_states_for_hide_sidebar() {
|
||||
};
|
||||
|
||||
// Hide the sidebar
|
||||
info("Check the launcher is initially hidden");
|
||||
info("Check default hidden state.");
|
||||
await checkStates({ hidden: false });
|
||||
info("Hide sidebar using the toolbar button.");
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarButton, {}, win);
|
||||
await checkStates({ hidden: true });
|
||||
|
||||
info("Show sidebar using the toolbar button.");
|
||||
EventUtils.synthesizeMouseAtCenter(toolbarButton, {}, win);
|
||||
await checkStates({ hidden: false });
|
||||
@@ -305,7 +297,7 @@ add_task(async function test_states_for_hide_sidebar_vertical() {
|
||||
);
|
||||
};
|
||||
|
||||
// Check initial sidebar state - it should be hidden
|
||||
// Hide the sidebar
|
||||
info("Check default hidden state.");
|
||||
await checkStates({ hidden: true, expanded: false });
|
||||
info("Show expanded sidebar using the toolbar button.");
|
||||
|
||||
Reference in New Issue
Block a user