Bug 1778722 - Hide existing "Add-ons and themes" widget when "unifiedExtensions" pref is set. r=rpl

Note: the pref now requires a restart.

Depends on D151497

Differential Revision: https://phabricator.services.mozilla.com/D151699
This commit is contained in:
William Durand
2022-07-19 15:10:00 +00:00
parent 030a4eb213
commit 65911f4a24
3 changed files with 70 additions and 30 deletions

View File

@@ -296,6 +296,12 @@ const CustomizableWidgets = [
id: "add-ons-button",
shortcutId: "key_openAddons",
l10nId: "toolbar-addons-themes-button",
onBeforeCreated() {
// If the pref is set to `true`, we won't create this widget.
return !Services.prefs.getBoolPref(
"extensions.unifiedExtensions.enabled"
);
},
onCommand(aEvent) {
let win = aEvent.target.ownerGlobal;
win.BrowserOpenAddonsMgr();