From 039b7ca85cbde9966cd4777a1f7f4125a26762aa Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Wed, 7 May 2025 23:05:07 +0200 Subject: [PATCH] feat: Remove home button from default toolbar, b=(no-bug), c=no-component --- .../CustomizableUI-sys-mjs.patch | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch index cb6c33bd0..460601768 100644 --- a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch +++ b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs -index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f0957350d49a03e 100644 +index 91088fab1759b9af908912648d28daa5938a29c9..52d348342c110dfae47a0d83b30b75ee888a3f78 100644 --- a/browser/components/customizableui/CustomizableUI.sys.mjs +++ b/browser/components/customizableui/CustomizableUI.sys.mjs @@ -13,6 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, { @@ -10,13 +10,19 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 HomePage: "resource:///modules/HomePage.sys.mjs", PanelMultiView: "resource:///modules/PanelMultiView.sys.mjs", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs", -@@ -338,13 +339,11 @@ var CustomizableUIInternal = { +@@ -331,20 +332,14 @@ var CustomizableUIInternal = { + "back-button", + "forward-button", + "stop-reload-button", +- Services.policies.isAllowed("removeHomeButtonByDefault") +- ? null +- : "home-button", + "spring", "vertical-spacer", "urlbar-container", "spring", - "save-to-pocket-button", - "downloads-button", -+// "downloads-button", AppConstants.MOZ_DEV_EDITION ? "developer-button" : null, - "fxa-toolbar-menu-button", lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null, @@ -26,7 +32,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 this.registerArea( CustomizableUI.AREA_NAVBAR, { -@@ -352,7 +351,6 @@ var CustomizableUIInternal = { +@@ -352,7 +347,6 @@ var CustomizableUIInternal = { overflowable: true, defaultPlacements: navbarPlacements, verticalTabsDefaultPlacements: [ @@ -34,7 +40,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 "alltabs-button", ], defaultCollapsed: false, -@@ -377,10 +375,7 @@ var CustomizableUIInternal = { +@@ -377,10 +371,7 @@ var CustomizableUIInternal = { { type: CustomizableUI.TYPE_TOOLBAR, defaultPlacements: [ @@ -45,7 +51,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 ], verticalTabsDefaultPlacements: [], defaultCollapsed: null, -@@ -462,6 +457,7 @@ var CustomizableUIInternal = { +@@ -462,6 +453,7 @@ var CustomizableUIInternal = { CustomizableUI.AREA_NAVBAR, CustomizableUI.AREA_BOOKMARKS, CustomizableUI.AREA_TABSTRIP, @@ -53,7 +59,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 ]); if (AppConstants.platform != "macosx") { toolbars.add(CustomizableUI.AREA_MENUBAR); -@@ -1262,6 +1258,9 @@ var CustomizableUIInternal = { +@@ -1262,6 +1254,9 @@ var CustomizableUIInternal = { placements = gPlacements.get(area); } @@ -63,7 +69,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 // For toolbars that need it, mark as dirty. let defaultPlacements = areaProperties.get("defaultPlacements"); if ( -@@ -1769,7 +1768,7 @@ var CustomizableUIInternal = { +@@ -1769,7 +1764,7 @@ var CustomizableUIInternal = { lazy.log.info( "Widget " + aWidgetId + " not found, unable to remove from " + aArea ); @@ -72,7 +78,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 } this.notifyDOMChange(widgetNode, null, container, true, () => { -@@ -1779,7 +1778,7 @@ var CustomizableUIInternal = { +@@ -1779,7 +1774,7 @@ var CustomizableUIInternal = { // We also need to remove the panel context menu if it's there: this.ensureButtonContextMenu(widgetNode); if (gPalette.has(aWidgetId) || this.isSpecialWidget(aWidgetId)) { @@ -81,7 +87,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 } else { window.gNavToolbox.palette.appendChild(widgetNode); } -@@ -1947,16 +1946,16 @@ var CustomizableUIInternal = { +@@ -1947,16 +1942,16 @@ var CustomizableUIInternal = { elem.setAttribute("skipintoolbarset", "true"); } } @@ -101,7 +107,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 // Handle initial state of vertical tabs. if (isVerticalTabs) { // Show the vertical tabs toolbar -@@ -2198,6 +2197,10 @@ var CustomizableUIInternal = { +@@ -2198,6 +2193,10 @@ var CustomizableUIInternal = { * The identifier string of the area that aNode is being inserted into. */ insertWidgetBefore(aNode, aNextNode, aContainer, aAreaId) { @@ -112,7 +118,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 this.notifyDOMChange(aNode, aNextNode, aContainer, false, () => { this.setLocationAttributes(aNode, aAreaId); aContainer.insertBefore(aNode, aNextNode); -@@ -3321,7 +3324,6 @@ var CustomizableUIInternal = { +@@ -3321,7 +3320,6 @@ var CustomizableUIInternal = { if (!this.isWidgetRemovable(aWidgetId)) { return; } @@ -120,7 +126,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 let placements = gPlacements.get(oldPlacement.area); let position = placements.indexOf(aWidgetId); if (position != -1) { -@@ -4556,7 +4558,7 @@ var CustomizableUIInternal = { +@@ -4556,7 +4554,7 @@ var CustomizableUIInternal = { * For all registered areas, builds those areas to reflect the current * placement state of all widgets. */ @@ -129,7 +135,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 for (let [areaId, areaNodes] of gBuildAreas) { let placements = gPlacements.get(areaId); let isFirstChangedToolbar = true; -@@ -4567,7 +4569,7 @@ var CustomizableUIInternal = { +@@ -4567,7 +4565,7 @@ var CustomizableUIInternal = { if (area.get("type") == CustomizableUI.TYPE_TOOLBAR) { let defaultCollapsed = area.get("defaultCollapsed"); let win = areaNode.ownerGlobal; @@ -138,7 +144,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 win.setToolbarVisibility( areaNode, typeof defaultCollapsed == "string" -@@ -5858,6 +5860,7 @@ export var CustomizableUI = { +@@ -5858,6 +5856,7 @@ export var CustomizableUI = { unregisterArea(aName, aDestroyPlacements) { CustomizableUIInternal.unregisterArea(aName, aDestroyPlacements); }, @@ -146,7 +152,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 /** * Add a widget to an area. * If the area to which you try to add is not known to CustomizableUI, -@@ -7905,11 +7908,11 @@ class OverflowableToolbar { +@@ -7905,11 +7904,11 @@ class OverflowableToolbar { parseFloat(style.paddingLeft) - parseFloat(style.paddingRight) - toolbarChildrenWidth; @@ -160,7 +166,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 }); lazy.log.debug( -@@ -7919,7 +7922,8 @@ class OverflowableToolbar { +@@ -7919,7 +7918,8 @@ class OverflowableToolbar { // If the target has min-width: 0, their children might actually overflow // it, so check for both cases explicitly. let targetContentWidth = Math.max(targetWidth, targetChildrenWidth); @@ -170,7 +176,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 return { isOverflowing, targetContentWidth, totalAvailWidth }; } -@@ -8013,7 +8017,7 @@ class OverflowableToolbar { +@@ -8013,7 +8013,7 @@ class OverflowableToolbar { } } if (!inserted) { @@ -179,7 +185,7 @@ index 91088fab1759b9af908912648d28daa5938a29c9..399ee5303c909c7bd81cbfad3f095735 } child.removeAttribute("cui-anchorid"); child.removeAttribute("overflowedItem"); -@@ -8358,7 +8362,7 @@ class OverflowableToolbar { +@@ -8358,7 +8358,7 @@ class OverflowableToolbar { break; } case "mousedown": {