From 4819ead6eb154dad5b2277c4b48c9a0664d9dabb Mon Sep 17 00:00:00 2001 From: Marco Bonardo Date: Wed, 24 Mar 2021 09:48:45 +0000 Subject: [PATCH] Bug 1700364 - Page action buttons should not be remove-able in Proton. r=adw Differential Revision: https://phabricator.services.mozilla.com/D109519 --- browser/base/content/browser-pageActions.js | 10 ++++++++-- browser/base/content/browser.css | 11 +++++++++++ browser/base/content/browser.xhtml | 2 +- .../modules/test/browser/browser_UsageTelemetry_toolbars.js | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js index 096012abde72..073404a8db2b 100644 --- a/browser/base/content/browser-pageActions.js +++ b/browser/base/content/browser-pageActions.js @@ -940,11 +940,17 @@ var BrowserPageActions = { return; } - this._contextAction = this.actionForNode(popup.triggerNode); - if (!this._contextAction) { + let action = this.actionForNode(popup.triggerNode); + if ( + !action || + // In Proton, only extension actions provide a context menu. + (UrlbarPrefs.get("browser.proton.urlbar.enabled") && !action.extensionID) + ) { + this._contextAction = null; event.preventDefault(); return; } + this._contextAction = action; let state; if (this._contextAction._isMozillaAction) { diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 44ee3d93379c..7164f9c575e0 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -1377,12 +1377,23 @@ toolbarpaletteitem > #stop-reload-button { #pageActionContextMenu > .pageActionContextMenuItem { visibility: collapse; } + +#pageActionContextMenu[state=extensionPinned] > .pageActionContextMenuItem.manageExtensionItem, +#pageActionContextMenu[state=extensionUnpinned] > .pageActionContextMenuItem.manageExtensionItem, +#pageActionContextMenu[state=extensionPinned] > .pageActionContextMenuItem.removeExtensionItem, +#pageActionContextMenu[state=extensionUnpinned] > .pageActionContextMenuItem.removeExtensionItem { + visibility: visible; +} + +@supports not -moz-bool-pref("browser.proton.urlbar.enabled") { +/* These pin/unpin menu options should be removed after Proton is released */ #pageActionContextMenu[state=builtInPinned] > .pageActionContextMenuItem.builtInPinned, #pageActionContextMenu[state=builtInUnpinned] > .pageActionContextMenuItem.builtInUnpinned, #pageActionContextMenu[state=extensionPinned] > .pageActionContextMenuItem.extensionPinned, #pageActionContextMenu[state=extensionUnpinned] > .pageActionContextMenuItem.extensionUnpinned { visibility: visible; } +} /*** !proton ***/ /* Print pending */ .printSettingsBrowser { diff --git a/browser/base/content/browser.xhtml b/browser/base/content/browser.xhtml index c6b3304d2b7a..9f7df3e31015 100644 --- a/browser/base/content/browser.xhtml +++ b/browser/base/content/browser.xhtml @@ -607,7 +607,7 @@ oncommand="BrowserPageActions.togglePinningForContextAction();" data-l10n-id="page-action-remove-from-urlbar"/> - { // Create a default state. -- 2.11.4.GIT