diff --git a/browser/components/preferences/tests/browser_experimental_features_filter.js b/browser/components/preferences/tests/browser_experimental_features_filter.js index c9aebc9d171c..4b596786c413 100644 --- a/browser/components/preferences/tests/browser_experimental_features_filter.js +++ b/browser/components/preferences/tests/browser_experimental_features_filter.js @@ -17,7 +17,7 @@ add_task(async function testFilterFeatures() { id: "test-featureA", preference: "test.featureA", title: "Experimental Feature 1", - group: "experimental-features-group-customize-browsing", + group: "experimental-features-group-browsing", description: "This is a fun experimental feature you can enable", result: true, }, @@ -25,7 +25,7 @@ add_task(async function testFilterFeatures() { id: "test-featureB", preference: "test.featureB", title: "Experimental Thing 2", - group: "experimental-features-group-customize-browsing", + group: "experimental-features-group-browsing", description: "This is a very boring experimental tool", // Visible since it's grouped with other features that match the search. result: true, @@ -34,7 +34,7 @@ add_task(async function testFilterFeatures() { id: "test-featureC", preference: "test.featureC", title: "Experimental Thing 3", - group: "experimental-features-group-customize-browsing", + group: "experimental-features-group-browsing", description: "This is a fun experimental feature for you can enable", result: true, }, diff --git a/browser/components/preferences/tests/head.js b/browser/components/preferences/tests/head.js index 1baa03fa169a..bc53a9a08cfb 100644 --- a/browser/components/preferences/tests/head.js +++ b/browser/components/preferences/tests/head.js @@ -203,7 +203,7 @@ class DefinitionServer { id: "test-feature", // These l10n IDs are just random so we have some text to display title: "experimental-features-media-jxl", - group: "experimental-features-group-customize-browsing", + group: "experimental-features-group-browsing", description: "pane-experimental-description3", restartRequired: false, type: "boolean", diff --git a/browser/components/sessionstore/test/marionette/test_restore_sidebar.py b/browser/components/sessionstore/test/marionette/test_restore_sidebar.py index 95ccc0fa308c..76dc7d34ee24 100644 --- a/browser/components/sessionstore/test/marionette/test_restore_sidebar.py +++ b/browser/components/sessionstore/test/marionette/test_restore_sidebar.py @@ -166,6 +166,7 @@ class TestSessionRestore(SessionStoreTestCase): self.marionette.execute_script( """ const window = BrowserWindowTracker.getTopWindow(); + window.SidebarController.toolbarButton.click(); return window.SidebarController.sidebarContainer.hidden; """ ), diff --git a/browser/components/sidebar/browser-sidebar.js b/browser/components/sidebar/browser-sidebar.js index f1c1ee81e932..8b4f22ebc13f 100644 --- a/browser/components/sidebar/browser-sidebar.js +++ b/browser/components/sidebar/browser-sidebar.js @@ -21,8 +21,7 @@ var SidebarController = { return document.getElementById(elementId); }, get title() { - let element = document.getElementById(elementId); - return element?.getAttribute("label"); + return document.getElementById(elementId).getAttribute("label"); }, ...rest, }; @@ -38,9 +37,8 @@ var SidebarController = { const viewItem = document.getElementById(sidebar.menuId); viewItem.hidden = !visible; - let menuItem = document.getElementById(config.elementId); // Add/remove switcher menu item. - if (visible && !menuItem) { + if (visible) { switcherMenuitem = this.createMenuItem(commandID, sidebar); switcherMenuitem.setAttribute("id", config.elementId); switcherMenuitem.removeAttribute("type"); @@ -69,10 +67,6 @@ var SidebarController = { return this._sidebars; } - return this.generateSidebarsMap(); - }, - - generateSidebarsMap() { this._sidebars = new Map([ [ "viewHistorySidebar", @@ -204,11 +198,6 @@ var SidebarController = { _switcherTarget: null, _switcherArrow: null, _inited: false, - _switcherListenersAdded: false, - _verticalNewTabListenerAdded: false, - _localesObserverAdded: false, - _mainResizeObserverAdded: false, - _mainResizeObserver: null, /** * @type {MutationObserver | null} @@ -257,6 +246,11 @@ var SidebarController = { this._switcherPanel = document.getElementById("sidebarMenu-popup"); this._switcherTarget = document.getElementById("sidebar-switcher-target"); this._switcherArrow = document.getElementById("sidebar-switcher-arrow"); + let newTabButton = document.getElementById("vertical-tabs-newtab-button"); + + newTabButton.addEventListener("command", event => { + BrowserCommands.openTab({ event }); + }); if ( Services.prefs.getBoolPref( "browser.tabs.allow_transparent_browser", @@ -277,10 +271,8 @@ var SidebarController = { menubar.appendChild(menuitem); } } - if (this._mainResizeObserver) { - this._mainResizeObserver.disconnect(); - } - this._mainResizeObserver = new ResizeObserver(async ([entry]) => { + + let mainResizeObserver = new ResizeObserver(async ([entry]) => { let sidebarBox = document.getElementById("sidebar-box"); sidebarBox.style.maxWidth = `calc(75vw - ${entry.contentBoxSize[0].inlineSize}px)`; }); @@ -297,43 +289,27 @@ var SidebarController = { !window.toolbar.visible || (this.sidebarRevampVisibility === "hide-sidebar" && !this.isOpen); document.getElementById("sidebar-header").hidden = true; - if (!this._mainResizeObserverAdded) { - this._mainResizeObserver.observe(this.sidebarMain); - this._mainResizeObserverAdded = true; - } + mainResizeObserver.observe(this.sidebarMain); if (this.sidebarVerticalTabsEnabled) { this.toggleTabstrip(); } - let newTabButton = document.getElementById("vertical-tabs-newtab-button"); - if (!this._verticalNewTabListenerAdded) { - newTabButton.addEventListener("command", event => { - BrowserCommands.openTab({ event }); - }); - this._verticalNewTabListenerAdded = true; - } } else { this._switcherCloseButton = document.getElementById("sidebar-close"); - if (!this._switcherListenersAdded) { - this._switcherCloseButton.addEventListener("command", () => { - this.hide(); - }); - this._switcherTarget.addEventListener("command", () => { - this.toggleSwitcherPanel(); - }); - this._switcherTarget.addEventListener("keydown", event => { - this.handleKeydown(event); - }); - this._switcherListenersAdded = true; - } + this._switcherCloseButton.addEventListener("command", () => { + this.hide(); + }); + this._switcherTarget.addEventListener("command", () => { + this.toggleSwitcherPanel(); + }); + this._switcherTarget.addEventListener("keydown", event => { + this.handleKeydown(event); + }); } this._inited = true; - if (!this._localesObserverAdded) { - Services.obs.addObserver(this, "intl:app-locales-changed"); - this._localesObserverAdded = true; - } + Services.obs.addObserver(this, "intl:app-locales-changed"); this._initDeferred.resolve(); }, @@ -355,11 +331,6 @@ var SidebarController = { this._observer = null; } - if (this._mainResizeObserver) { - this._mainResizeObserver.disconnect(); - this._mainResizeObserver = null; - } - if (this.revampComponentsLoaded) { // Explicitly disconnect the `sidebar-main` element so that listeners // setup by reactive controllers will also be removed. @@ -537,41 +508,6 @@ var SidebarController = { } }, - /** - * Show/hide new sidebar based on sidebar.revamp pref - */ - async toggleRevampSidebar() { - if (this.isOpen) { - this.hide(); - } - // Reset sidebars map but preserve any existing extensions - let extensionsArr = []; - for (const [commandID, sidebar] of this.sidebars.entries()) { - if (sidebar.hasOwnProperty("extensionId")) { - extensionsArr.push({ commandID, sidebar }); - } - } - this.sidebars = this.generateSidebarsMap(); - for (const extension of extensionsArr) { - this.sidebars.set(extension.commandID, extension.sidebar); - } - if (!this.sidebarRevampEnabled) { - this.sidebarMain.hidden = true; - document.getElementById("sidebar-header").hidden = false; - // Disable vertical tabs if revamped sidebar is turned off - if (this.sidebarVerticalTabsEnabled) { - Services.prefs.setBoolPref("sidebar.verticalTabs", false); - } - } else { - this.sidebarMain.hidden = false; - } - if (!this._sidebars.get(this.lastOpenedId)) { - this.lastOpenedId = this.DEFAULT_SIDEBAR_ID; - } - this.show(this.lastOpenedId); - await this.init(); - }, - /** * Try and adopt the status of the sidebar from another window. * @@ -1215,7 +1151,7 @@ var SidebarController = { // until about:blank has loaded (which does not happen as long as the // element is hidden). this.browser.setAttribute("src", "about:blank"); - this.browser.docShell?.createAboutBlankDocumentViewer(null, null); + this.browser.docShell.createAboutBlankDocumentViewer(null, null); this._box.removeAttribute("checked"); this._box.hidden = this._splitter.hidden = true; @@ -1270,11 +1206,6 @@ var SidebarController = { arrowScrollbox.setAttribute("orient", "vertical"); tabStrip.setAttribute("orient", "vertical"); verticalTabs.append(tabStrip); - - // Enable revamped sidebar if vertical tabs is enabled - if (!this.sidebarRevampEnabled) { - Services.prefs.setBoolPref("sidebar.revamp", true); - } } else { arrowScrollbox.setAttribute("orient", "horizontal"); tabStrip.setAttribute("orient", "horizontal"); @@ -1310,8 +1241,7 @@ XPCOMUtils.defineLazyPreferenceGetter( SidebarController, "sidebarRevampEnabled", "sidebar.revamp", - false, - SidebarController.toggleRevampSidebar.bind(SidebarController) + false ); XPCOMUtils.defineLazyPreferenceGetter( SidebarController, diff --git a/browser/components/sidebar/tests/browser/browser_sidebar_panel_switcher.js b/browser/components/sidebar/tests/browser/browser_sidebar_panel_switcher.js index 30964986bca5..43ad285ad891 100644 --- a/browser/components/sidebar/tests/browser/browser_sidebar_panel_switcher.js +++ b/browser/components/sidebar/tests/browser/browser_sidebar_panel_switcher.js @@ -28,4 +28,4 @@ add_task(async function test_switcher_twice() { ok(SidebarController.isOpen, "Stays open on second click"); SidebarController.hide(); -}).skip(); // bug 1896421 +}); diff --git a/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js b/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js index 2389e3eaad87..deaa9e8952bb 100644 --- a/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js +++ b/browser/components/sidebar/tests/browser/browser_sidebar_prefs.js @@ -142,53 +142,3 @@ add_task(async function test_conditional_tools() { await BrowserTestUtils.closeWindow(win); }); - -/** - * Check that the new sidebar is hidden/shown automatically (without a browser restart) - * when flipping the sidebar.revamp pref - */ -add_task(async function test_flip_revamp_pref() { - const win = await BrowserTestUtils.openNewBrowserWindow(); - const sidebar = win.document.querySelector("sidebar-main"); - await sidebar.updateComplete; - - let verticalTabs = win.document.querySelector("#vertical-tabs"); - ok( - !BrowserTestUtils.isVisible(verticalTabs), - "Vertical tabs slot is not visible initially" - ); - // Open history sidebar - await toggleSidebarPanel(win, "viewHistorySidebar"); - - await SpecialPowers.pushPrefEnv({ set: [["sidebar.verticalTabs", true]] }); - ok(BrowserTestUtils.isVisible(verticalTabs), "Vertical tabs slot is visible"); - - ok(sidebar, "Revamped sidebar is shown initially."); - - await SpecialPowers.pushPrefEnv({ set: [["sidebar.revamp", false]] }); - - await TestUtils.waitForCondition(() => { - let isSidebarMainShown = !win.document.querySelector("sidebar-main").hidden; - let isSwitcherPanelShown = - !win.document.getElementById("sidebar-header").hidden; - // Vertical tabs pref should be turned off when revamp pref is turned off - let isVerticalTabsShown = BrowserTestUtils.isVisible(verticalTabs); - return !isSidebarMainShown && isSwitcherPanelShown && !isVerticalTabsShown; - }, "The new sidebar is hidden and the old sidebar is shown."); - - ok(true, "The new sidebar is hidden and the old sidebar is shown."); - - await SpecialPowers.pushPrefEnv({ - set: [["sidebar.revamp", true]], - }); - await sidebar.updateComplete; - await TestUtils.waitForCondition(() => { - let isSidebarMainShown = !document.querySelector("sidebar-main").hidden; - let isSwitcherPanelShown = - !win.document.getElementById("sidebar-header").hidden; - return isSidebarMainShown && !isSwitcherPanelShown; - }, "The old sidebar is hidden and the new sidebar is shown."); - - ok(true, "The old sidebar is hidden and the new sidebar is shown."); - await BrowserTestUtils.closeWindow(win); -}); diff --git a/browser/components/sidebar/tests/browser/browser_toolbar_sidebar_button.js b/browser/components/sidebar/tests/browser/browser_toolbar_sidebar_button.js index ba2be67fb8df..71885e368563 100644 --- a/browser/components/sidebar/tests/browser/browser_toolbar_sidebar_button.js +++ b/browser/components/sidebar/tests/browser/browser_toolbar_sidebar_button.js @@ -201,4 +201,4 @@ add_task(async function test_states_for_hide_sidebar() { await BrowserTestUtils.closeWindow(win); await BrowserTestUtils.closeWindow(newWin); await SpecialPowers.popPrefEnv(); -}).skip(); //bug 1896421 +}); diff --git a/toolkit/components/featuregates/Features.toml b/toolkit/components/featuregates/Features.toml index f7cb8d6fe91b..5693b9f2bd08 100644 --- a/toolkit/components/featuregates/Features.toml +++ b/toolkit/components/featuregates/Features.toml @@ -14,32 +14,8 @@ # based on the order of appearance in this file. Settings within # a group will also be determined by their order in this file. -[sidebar] -group = "experimental-features-group-customize-browsing" -title = "sidebar-title" -description = "sidebar-description" -description-links = {connect= "https://connect.mozilla.org/t5/discussions/firefox-sidebar-and-vertical-tabs-try-them-out-in-nightly/m-p/63231#M22243"} -restart-required = false -preference = "sidebar.revamp" -type = "boolean" -bug-numbers = [1906140] -is-public-jexl = "nightly_build" -default-value-jexl = "false" - -[vertical-tabs] -group = "experimental-features-group-customize-browsing" -title = "vertical-tabs-title" -description = "vertical-tabs-description" -description-links = {connect= "https://connect.mozilla.org/t5/discussions/firefox-sidebar-and-vertical-tabs-try-them-out-in-nightly/m-p/63231#M22243"} -restart-required = false -preference = "sidebar.verticalTabs" -type = "boolean" -bug-numbers = [1906140] -is-public-jexl = "nightly_build" -default-value-jexl = "false" - [genai-chat] -group = "experimental-features-group-customize-browsing" +group = "experimental-features-group-browsing" title = "genai-settings-chat-title" description = "genai-settings-chat-description" description-links = {connect= "https://connect.mozilla.org/t5/discussions/share-your-feedback-on-the-ai-services-experiment-in-nightly/m-p/60519#M21202"} @@ -51,7 +27,7 @@ is-public-jexl = "nightly_build" default-value-jexl = "false" [url-bar-ime-search] -group = "experimental-features-group-customize-browsing" +group = "experimental-features-group-browsing" title = "experimental-features-ime-search" description = "experimental-features-ime-search-description" restart-required = false @@ -62,7 +38,7 @@ is-public-jexl = "true" default-value-jexl = "false" [auto-pip] -group = "experimental-features-group-customize-browsing" +group = "experimental-features-group-browsing" title = "experimental-features-auto-pip" description = "experimental-features-auto-pip-description" restart-required = false @@ -73,7 +49,7 @@ is-public-jexl = "true" default-value-jexl = "false" [webrtc-global-mute-toggles] -group = "experimental-features-group-customize-browsing" +group = "experimental-features-group-browsing" title = "experimental-features-webrtc-global-mute-toggles" description = "experimental-features-webrtc-global-mute-toggles-description" restart-required = false @@ -84,7 +60,7 @@ is-public-jexl = "nightly_build" default-value-jexl = "false" [cookie-samesite-none-requires-secure] -group = "experimental-features-group-customize-browsing" +group = "experimental-features-group-browsing" title = "experimental-features-cookie-samesite-none-requires-secure2" description = "experimental-features-cookie-samesite-none-requires-secure2-description" restart-required = false diff --git a/toolkit/locales/en-US/toolkit/featuregates/features.ftl b/toolkit/locales/en-US/toolkit/featuregates/features.ftl index 34428a13d893..7a94d6447e26 100644 --- a/toolkit/locales/en-US/toolkit/featuregates/features.ftl +++ b/toolkit/locales/en-US/toolkit/featuregates/features.ftl @@ -51,18 +51,10 @@ experimental-features-auto-pip = .label = Picture-in-Picture: auto-open on tab switch experimental-features-auto-pip-description = Enable Picture-in-Picture on active videos when switching tabs. -# Updated sidebar settings -sidebar-title = - .label = Sidebar -sidebar-description = Easily access your history, tabs from other devices, sidebar extensions, and more as you browse. Share feedback -vertical-tabs-title = - .label = Vertical tabs -vertical-tabs-description = Move your tabs from the top of the browser to the side. Requires you also try the sidebar. Share feedback +experimental-features-group-browsing = + .label = Browsing experimental-features-group-developer-tools = .label = Developer Tools experimental-features-group-webpage-display = .label = Webpage Display -experimental-features-group-customize-browsing = - .label = Customize your browsing -experimental-features-group-customize-browsing-description = If you try these features, share your thoughts on Connect