зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1702144, ensure recently closed tabs button is disabled when there are none r=Gijs
Removes macos rule that overrides disabled css rules Removes early return to ensure the menu is created correctly Differential Revision: https://phabricator.services.mozilla.com/D111919
This commit is contained in:
Родитель
39587cd40f
Коммит
d7fbf79bf9
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче