diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm index 730b14360411..3a70469eba94 100644 --- a/browser/components/customizableui/CustomizableWidgets.jsm +++ b/browser/components/customizableui/CustomizableWidgets.jsm @@ -102,6 +102,9 @@ const CustomizableWidgets = [ case "ViewShowing": this.onSubViewShowing(event); break; + case "unload": + this.onWindowUnload(event); + break; default: throw new Error(`Unsupported event for '${this.id}'`); } @@ -166,6 +169,7 @@ const CustomizableWidgets = [ // When the popup is hidden (thus the panelmultiview node as well), make // sure to stop listening to PlacesDatabase updates. panelview.panelMultiView.addEventListener("PanelMultiViewHidden", this); + window.addEventListener("unload", this); }, onViewHiding(event) { log.debug("History view is being hidden!"); @@ -187,6 +191,11 @@ const CustomizableWidgets = [ } panelMultiView.removeEventListener("PanelMultiViewHidden", this); }, + onWindowUnload(event) { + if (this._panelMenuView) { + delete this._panelMenuView; + } + }, onSubViewShowing(event) { let panelview = event.target; let document = event.target.ownerDocument; diff --git a/browser/components/customizableui/test/browser_history_recently_closed.js b/browser/components/customizableui/test/browser_history_recently_closed.js index 89ad09e6cae0..6a286b660aa1 100644 --- a/browser/components/customizableui/test/browser_history_recently_closed.js +++ b/browser/components/customizableui/test/browser_history_recently_closed.js @@ -94,3 +94,53 @@ add_task(async function testRecentlyClosedDisabled() { await hideHistoryPanel(); }); + +add_task(async function testRecentlyClosedTabsDisabledPersists() { + info("Check history recently closed tabs/windows section"); + + CustomizableUI.addWidgetToArea( + "history-panelmenu", + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL + ); + registerCleanupFunction(() => CustomizableUI.reset()); + + // We need to make sure the history is cleared before starting the test + await Sanitizer.sanitize(["history"]); + + await openHistoryPanel(); + + let recentlyClosedTabs = document.getElementById("appMenuRecentlyClosedTabs"); + Assert.ok( + recentlyClosedTabs.getAttribute("disabled"), + "Recently closed tabs button disabled" + ); + + await hideHistoryPanel(); + + let newWin = await BrowserTestUtils.openNewBrowserWindow(); + + await openHistoryPanel(newWin.document); + recentlyClosedTabs = newWin.document.getElementById( + "appMenuRecentlyClosedTabs" + ); + Assert.ok( + recentlyClosedTabs.getAttribute("disabled"), + "Recently closed tabs is disabled" + ); + + // We close the window without hiding the panel first, which used to interfere + // with populating the view subsequently. + await BrowserTestUtils.closeWindow(newWin); + + newWin = await BrowserTestUtils.openNewBrowserWindow(); + await openHistoryPanel(newWin.document); + recentlyClosedTabs = newWin.document.getElementById( + "appMenuRecentlyClosedTabs" + ); + Assert.ok( + recentlyClosedTabs.getAttribute("disabled"), + "Recently closed tabs is disabled" + ); + await hideHistoryPanel(newWin.document); + await BrowserTestUtils.closeWindow(newWin); +}); diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 80f62302fefd..6f5ffe6790f4 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -86,12 +86,12 @@ #tabbrowser-tabs { --tab-line-color: -moz-accent-color; } -} /* END !proton */ #navigator-toolbox toolbarbutton:-moz-lwtheme { color: inherit; text-shadow: inherit; } +} /* END !proton */ @media not (-moz-proton) { :root[macOSNativeFullscreen]:not(:-moz-lwtheme) :is(#navigator-toolbox, #sidebar-box) {