Bug 1799009 - Remove unified extensions pref and non-unified extensions variants from test suite. r=rpl,mconley,fluent-reviewers,desktop-theme-reviewers,Itiel

This patch removes the use of the "unified extensions" pref and adjust
the existing tests. More clean-ups will be done in follow-ups, e.g. the
removal of `gUnifiedExtensions.isEnabled` and some test-only changes to
no longer create a new window in each test file.

Differential Revision: https://phabricator.services.mozilla.com/D166908
This commit is contained in:
William Durand 2023-01-19 10:59:25 +00:00
Родитель 20d4fcf500
Коммит 09093658ff
27 изменённых файлов: 150 добавлений и 611 удалений

Просмотреть файл

@ -73,9 +73,6 @@ pref("xpinstall.signatures.devInfoURL", "https://wiki.mozilla.org/Addons/Extensi
// Enable extensionStorage storage actor by default
pref("devtools.storage.extensionStorage.enabled", true);
// Enable the unified extensions UI by default.
pref("extensions.unifiedExtensions.enabled", true);
// Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/language-tools/");

Просмотреть файл

@ -1279,10 +1279,7 @@ var gUnifiedExtensions = {
},
get isEnabled() {
return Services.prefs.getBoolPref(
"extensions.unifiedExtensions.enabled",
false
);
return true;
},
onLocationChange(browser, webProgress, _request, _uri, flags) {

Просмотреть файл

@ -98,11 +98,6 @@ function removeFirefoxViewButton() {
const BOOKMARKS_COUNT = 100;
const hasUnifiedExtensionsButton = Services.prefs.getBoolPref(
"extensions.unifiedExtensions.enabled",
false
);
add_setup(async function() {
await SpecialPowers.pushPrefEnv({
set: [
@ -264,9 +259,7 @@ add_task(async function testArrowsToolbarbuttons() {
await expectFocusAfterKey("ArrowRight", "fxa-toolbar-menu-button");
// These next checks also confirm that the overflow menu button is skipped,
// since it is currently invisible.
if (hasUnifiedExtensionsButton) {
await expectFocusAfterKey("ArrowRight", "unified-extensions-button");
}
await expectFocusAfterKey("ArrowRight", "unified-extensions-button");
await expectFocusAfterKey("ArrowRight", "PanelUI-menu-button");
EventUtils.synthesizeKey("KEY_ArrowRight");
is(
@ -274,9 +267,7 @@ add_task(async function testArrowsToolbarbuttons() {
"PanelUI-menu-button",
"ArrowRight at end of button group does nothing"
);
if (hasUnifiedExtensionsButton) {
await expectFocusAfterKey("ArrowLeft", "unified-extensions-button");
}
await expectFocusAfterKey("ArrowLeft", "unified-extensions-button");
await expectFocusAfterKey("ArrowLeft", "fxa-toolbar-menu-button");
await expectFocusAfterKey("ArrowLeft", "sidebar-button");
await expectFocusAfterKey("ArrowLeft", "library-button");
@ -344,15 +335,11 @@ add_task(async function testArrowsOverflowButton() {
await expectFocusAfterKey("ArrowRight", "sidebar-button");
await expectFocusAfterKey("ArrowRight", "fxa-toolbar-menu-button");
await expectFocusAfterKey("ArrowRight", "nav-bar-overflow-button");
if (hasUnifiedExtensionsButton) {
await expectFocusAfterKey("ArrowRight", "unified-extensions-button");
}
await expectFocusAfterKey("ArrowRight", "unified-extensions-button");
// Make sure the button is not reachable once it is invisible again.
await expectFocusAfterKey("ArrowRight", "PanelUI-menu-button");
resetToolbarWithoutDevEditionButtons();
if (hasUnifiedExtensionsButton) {
await expectFocusAfterKey("ArrowLeft", "unified-extensions-button");
}
await expectFocusAfterKey("ArrowLeft", "unified-extensions-button");
// Flush layout so its invisibility can be detected.
document.getElementById("nav-bar-overflow-button").clientWidth;
await expectFocusAfterKey("ArrowLeft", "fxa-toolbar-menu-button");

Просмотреть файл

@ -50,7 +50,6 @@ const kPrefProtonToolbarVersion = "browser.proton.toolbar.version";
const kPrefHomeButtonUsed = "browser.engagement.home-button.has-used";
const kPrefLibraryButtonUsed = "browser.engagement.library-button.has-used";
const kPrefSidebarButtonUsed = "browser.engagement.sidebar-button.has-used";
const kPrefUnifiedExtensionsEnabled = "extensions.unifiedExtensions.enabled";
const kExpectedWindowURL = AppConstants.BROWSER_CHROME_URL;
@ -196,13 +195,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
}
);
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"gUnifiedExtensionsEnabled",
kPrefUnifiedExtensionsEnabled,
false
);
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
@ -444,6 +436,7 @@ var CustomizableUIInternal = {
"fullscreen-button",
"find-button",
"preferences-button",
// This widget no longer exists as of 2023, see Bug 1799009.
"add-ons-button",
"sync-button",
];
@ -707,47 +700,34 @@ var CustomizableUIInternal = {
let addonsPlacements =
gSavedState.placements[CustomizableUI.AREA_ADDONS] || [];
if (lazy.gUnifiedExtensionsEnabled) {
// Migration algorithm for transitioning to Unified Extensions:
//
// 1. Create two arrays, one for extension widgets, one for built-in widgets.
// 2. Iterate all items in the overflow panel, and push them into the
// appropriate array based on whether or not its an extension widget.
// 3. Overwrite the overflow panel placements with the built-in widgets array.
// 4. Prepend the extension widgets to the addonsPlacements array. Note that this
// does not overwrite this array as a precaution because it's possible
// (though pretty unlikely) that some widgets are already there.
//
// For extension widgets that were in the palette, they will be appended to the
// addons area when they're created within createWidget.
let extWidgets = [];
let builtInWidgets = [];
for (let widgetId of overflowPlacements) {
if (CustomizableUI.isWebExtensionWidget(widgetId)) {
extWidgets.push(widgetId);
} else {
builtInWidgets.push(widgetId);
}
// Migration algorithm for transitioning to Unified Extensions:
//
// 1. Create two arrays, one for extension widgets, one for built-in widgets.
// 2. Iterate all items in the overflow panel, and push them into the
// appropriate array based on whether or not its an extension widget.
// 3. Overwrite the overflow panel placements with the built-in widgets array.
// 4. Prepend the extension widgets to the addonsPlacements array. Note that this
// does not overwrite this array as a precaution because it's possible
// (though pretty unlikely) that some widgets are already there.
//
// For extension widgets that were in the palette, they will be appended to the
// addons area when they're created within createWidget.
let extWidgets = [];
let builtInWidgets = [];
for (let widgetId of overflowPlacements) {
if (CustomizableUI.isWebExtensionWidget(widgetId)) {
extWidgets.push(widgetId);
} else {
builtInWidgets.push(widgetId);
}
gSavedState.placements[
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
] = builtInWidgets;
gSavedState.placements[CustomizableUI.AREA_ADDONS] = [
...extWidgets,
...addonsPlacements,
];
} else {
// This is an emergency backstop in case things go sideways and we need to
// temporarily flip back the Unified Extensions pref if it had already been
// enabled. We will do simplest thing and just empty the AREA_ADDONS placements,
// and append them to the bottom of the overflow panel, and then blow away
// the AREA_ADDONS placements.
gSavedState.placements[CustomizableUI.AREA_FIXED_OVERFLOW_PANEL] = [
...overflowPlacements,
...addonsPlacements,
];
delete gSavedState.placements[CustomizableUI.AREA_ADDONS];
}
gSavedState.placements[
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
] = builtInWidgets;
gSavedState.placements[CustomizableUI.AREA_ADDONS] = [
...extWidgets,
...addonsPlacements,
];
},
/**
@ -1293,7 +1273,6 @@ var CustomizableUIInternal = {
let contextMenuForPlace;
if (
lazy.gUnifiedExtensionsEnabled &&
CustomizableUI.isWebExtensionWidget(aNode.id) &&
(aAreaNode?.id == CustomizableUI.AREA_ADDONS ||
aNode.getAttribute("overflowedItem") == "true")
@ -2920,7 +2899,6 @@ var CustomizableUIInternal = {
// at this point, we haven't found an area for them, move them into
// AREA_ADDONS.
if (
lazy.gUnifiedExtensionsEnabled &&
!widget.currentArea &&
CustomizableUI.isWebExtensionWidget(widget.id)
) {
@ -3327,14 +3305,12 @@ var CustomizableUIInternal = {
// doesn't get set, so we do that manually here.
gPlacements.set(CustomizableUI.AREA_ADDONS, []);
if (lazy.gUnifiedExtensionsEnabled) {
for (let [widgetId] of gPalette) {
if (
CustomizableUI.isWebExtensionWidget(widgetId) &&
!oldAddonPlacements.includes(widgetId)
) {
this.addWidgetToArea(widgetId, CustomizableUI.AREA_ADDONS);
}
for (let [widgetId] of gPalette) {
if (
CustomizableUI.isWebExtensionWidget(widgetId) &&
!oldAddonPlacements.includes(widgetId)
) {
this.addWidgetToArea(widgetId, CustomizableUI.AREA_ADDONS);
}
}
},
@ -3500,10 +3476,7 @@ var CustomizableUIInternal = {
return false;
}
if (
lazy.gUnifiedExtensionsEnabled &&
CustomizableUI.isWebExtensionWidget(aWidgetId)
) {
if (CustomizableUI.isWebExtensionWidget(aWidgetId)) {
// Extension widgets cannot move to the customization palette.
if (aArea == CustomizableUI.AREA_NO_AREA) {
return false;
@ -5697,11 +5670,7 @@ class OverflowableToolbar {
this.#target
);
if (
lazy.gUnifiedExtensionsEnabled &&
webExtList &&
CustomizableUI.isWebExtensionWidget(child.id)
) {
if (webExtList && CustomizableUI.isWebExtensionWidget(child.id)) {
child.setAttribute("cui-anchorid", webExtButtonID);
webExtList.insertBefore(child, webExtList.firstElementChild);
} else {

Просмотреть файл

@ -625,16 +625,3 @@ if (PrivateBrowsingUtils.enabled) {
},
});
}
// If the pref is set to `true`, we don't register this widget.
if (!Services.prefs.getBoolPref("extensions.unifiedExtensions.enabled")) {
CustomizableWidgets.push({
id: "add-ons-button",
shortcutId: "key_openAddons",
l10nId: "toolbar-addons-themes-button",
onCommand(aEvent) {
let win = aEvent.target.ownerGlobal;
win.BrowserOpenAddonsMgr();
},
});
}

Просмотреть файл

@ -53,7 +53,6 @@ skip-if = verify
[browser_942581_unregisterArea_keeps_placements.js]
[browser_944887_destroyWidget_should_destroy_in_palette.js]
[browser_945739_showInPrivateBrowsing_customize_mode.js]
[browser_947914_button_addons.js]
[browser_947914_button_copy.js]
[browser_947914_button_cut.js]
[browser_947914_button_find.js]

Просмотреть файл

@ -1,64 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var initialLocation = gBrowser.currentURI.spec;
add_task(async function() {
if (
Services.prefs.getBoolPref("extensions.unifiedExtensions.enabled", false)
) {
// When this pref is enabled, the "Add-ons and themes" button no longer
// exists so we cannot test it... In the future, we'll want to remove this
// test entirely since it won't be relevant when the unified extensions UI
// will be enabled on all channels.
ok(true, "Skip task because unifiedExtensions pref is enabled");
return;
}
CustomizableUI.addWidgetToArea(
"add-ons-button",
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
);
info("Check addons button existence and functionality");
await waitForOverflowButtonShown();
await document.getElementById("nav-bar").overflowable.show();
info("Menu panel was opened");
let addonsButton = document.getElementById("add-ons-button");
ok(addonsButton, "Add-ons button exists in Panel Menu");
addonsButton.click();
await Promise.all([
TestUtils.waitForCondition(
() => gBrowser.currentURI && gBrowser.currentURI.spec == "about:addons"
),
new Promise(r =>
gBrowser.selectedBrowser.addEventListener("load", r, true)
),
]);
let addonsPage = gBrowser.selectedBrowser.contentWindow.document.querySelector(
"title[data-l10n-id='addons-page-title']"
);
ok(addonsPage, "Add-ons page was opened");
});
add_task(async function asyncCleanup() {
if (
Services.prefs.getBoolPref("extensions.unifiedExtensions.enabled", false)
) {
// The comment in the task above also applies here.
ok(true, "Skip task because unifiedExtensions pref is enabled");
return;
}
CustomizableUI.reset();
BrowserTestUtils.addTab(gBrowser, initialLocation);
gBrowser.removeTab(gBrowser.selectedTab);
info("Tabs were restored");
});

Просмотреть файл

@ -15,10 +15,6 @@ const kWebExtensionButtonID2 = "fake-webextension-button-2";
let gWin = null;
add_setup(async function() {
await SpecialPowers.pushPrefEnv({
set: [["extensions.unifiedExtensions.enabled", true]],
});
gWin = await BrowserTestUtils.openNewBrowserWindow();
// To make it easier to write a test where we can control overflowing

Просмотреть файл

@ -49,16 +49,6 @@ function loadState() {
* forward migration.
*/
function migrateForward() {
Services.prefs.setBoolPref("extensions.unifiedExtensions.enabled", true);
CustomizableUIInternal._updateForUnifiedExtensions();
}
/**
* Disables the Unified Extensions UI pref and calls the function to perform
* backward migration.
*/
function migrateBackward() {
Services.prefs.setBoolPref("extensions.unifiedExtensions.enabled", false);
CustomizableUIInternal._updateForUnifiedExtensions();
}
@ -417,14 +407,6 @@ add_task(async function test_migrating_back_with_items() {
delete EXPECTED_STATE.placements[CustomizableUI.AREA_ADDONS];
saveState(SAVED_STATE);
migrateBackward();
Assert.deepEqual(
loadState(),
EXPECTED_STATE,
"Migrating backward should append the addons items to the overflow panel."
);
});
/**
@ -464,12 +446,4 @@ add_task(async function test_migrating_back_with_no_items() {
delete EXPECTED_STATE.placements[CustomizableUI.AREA_ADDONS];
saveState(SAVED_STATE);
migrateBackward();
Assert.deepEqual(
loadState(),
EXPECTED_STATE,
"Migrating backward should append the addons items to the overflow panel."
);
});

Просмотреть файл

@ -26,7 +26,6 @@ TESTING_JS_MODULES += [
DIRS += ["schemas"]
BROWSER_CHROME_MANIFESTS += [
"test/browser/browser-no-unified-extensions.ini",
"test/browser/browser-private.ini",
"test/browser/browser.ini",
]

Просмотреть файл

@ -53,24 +53,14 @@ const POPUP_PRELOAD_TIMEOUT_MS = 200;
const browserActionMap = new WeakMap();
XPCOMUtils.defineLazyGetter(this, "browserAreas", () => {
let panelArea = gUnifiedExtensionsEnabled
? CustomizableUI.AREA_ADDONS
: CustomizableUI.AREA_FIXED_OVERFLOW_PANEL;
return {
navbar: CustomizableUI.AREA_NAVBAR,
menupanel: panelArea,
menupanel: CustomizableUI.AREA_ADDONS,
tabstrip: CustomizableUI.AREA_TABSTRIP,
personaltoolbar: CustomizableUI.AREA_BOOKMARKS,
};
});
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gUnifiedExtensionsEnabled",
"extensions.unifiedExtensions.enabled",
false
);
function actionWidgetId(widgetId) {
return `${widgetId}-browser-action`;
}
@ -235,49 +225,47 @@ this.browserAction = class extends ExtensionAPIPersistent {
"subviewbutton"
);
if (gUnifiedExtensionsEnabled) {
let contents = document.createXULElement("vbox");
contents.classList.add("unified-extensions-item-contents");
contents.setAttribute("move-after-stack", "true");
let contents = document.createXULElement("vbox");
contents.classList.add("unified-extensions-item-contents");
contents.setAttribute("move-after-stack", "true");
let name = document.createXULElement("label");
name.classList.add("unified-extensions-item-name");
contents.appendChild(name);
let name = document.createXULElement("label");
name.classList.add("unified-extensions-item-name");
contents.appendChild(name);
// This deck (and its labels) should be kept in sync with
// `browser/base/content/unified-extensions-viewcache.inc.xhtml`.
let deck = document.createXULElement("deck");
deck.classList.add("unified-extensions-item-message-deck");
// This deck (and its labels) should be kept in sync with
// `browser/base/content/unified-extensions-viewcache.inc.xhtml`.
let deck = document.createXULElement("deck");
deck.classList.add("unified-extensions-item-message-deck");
let messageDefault = document.createXULElement("label");
messageDefault.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-default"
);
deck.appendChild(messageDefault);
let messageDefault = document.createXULElement("label");
messageDefault.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-default"
);
deck.appendChild(messageDefault);
let messageHover = document.createXULElement("label");
messageHover.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-hover"
);
deck.appendChild(messageHover);
let messageHover = document.createXULElement("label");
messageHover.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-hover"
);
deck.appendChild(messageHover);
let messageHoverForMenuButton = document.createXULElement("label");
messageHoverForMenuButton.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-hover-menu-button"
);
messageHoverForMenuButton.setAttribute(
"data-l10n-id",
"unified-extensions-item-message-manage"
);
deck.appendChild(messageHoverForMenuButton);
let messageHoverForMenuButton = document.createXULElement("label");
messageHoverForMenuButton.classList.add(
"unified-extensions-item-message",
"unified-extensions-item-message-hover-menu-button"
);
messageHoverForMenuButton.setAttribute(
"data-l10n-id",
"unified-extensions-item-message-manage"
);
deck.appendChild(messageHoverForMenuButton);
contents.appendChild(deck);
contents.appendChild(deck);
button.appendChild(contents);
}
button.appendChild(contents);
let menuButton = document.createXULElement("toolbarbutton");
menuButton.classList.add(
@ -286,24 +274,19 @@ this.browserAction = class extends ExtensionAPIPersistent {
"subviewbutton-iconic"
);
if (gUnifiedExtensionsEnabled) {
menuButton.setAttribute(
"data-l10n-id",
"unified-extensions-item-open-menu"
);
// Allow the users to quickly move between extension items using
// the arrow keys, see: `PanelMultiView._isNavigableWithTabOnly()`.
menuButton.setAttribute("data-navigable-with-tab-only", true);
}
menuButton.setAttribute(
"data-l10n-id",
"unified-extensions-item-open-menu"
);
// Allow the users to quickly move between extension items using
// the arrow keys, see: `PanelMultiView._isNavigableWithTabOnly()`.
menuButton.setAttribute("data-navigable-with-tab-only", true);
menuButton.setAttribute("data-extensionid", extension.id);
menuButton.setAttribute("closemenu", "none");
let node = document.createXULElement("toolbaritem");
node.setAttribute(
"unified-extensions",
String(gUnifiedExtensionsEnabled)
);
node.setAttribute("unified-extensions", String(true));
node.classList.add(
"toolbaritem-combined-buttons",
"unified-extensions-item"
@ -360,23 +343,21 @@ this.browserAction = class extends ExtensionAPIPersistent {
actionButton.onmouseout = event => this.handleEvent(event);
actionButton.onauxclick = event => this.handleEvent(event);
if (gUnifiedExtensionsEnabled) {
const menuButton = node.querySelector(
".unified-extensions-item-menu-button"
);
menuButton.setAttribute(
"data-l10n-args",
JSON.stringify({ extensionName: this.extension.name })
);
const menuButton = node.querySelector(
".unified-extensions-item-menu-button"
);
menuButton.setAttribute(
"data-l10n-args",
JSON.stringify({ extensionName: this.extension.name })
);
menuButton.onblur = event => this.handleMenuButtonEvent(event);
menuButton.onfocus = event => this.handleMenuButtonEvent(event);
menuButton.onmouseout = event => this.handleMenuButtonEvent(event);
menuButton.onmouseover = event => this.handleMenuButtonEvent(event);
menuButton.onblur = event => this.handleMenuButtonEvent(event);
menuButton.onfocus = event => this.handleMenuButtonEvent(event);
menuButton.onmouseout = event => this.handleMenuButtonEvent(event);
menuButton.onmouseover = event => this.handleMenuButtonEvent(event);
actionButton.onblur = event => this.handleEvent(event);
actionButton.onfocus = event => this.handleEvent(event);
}
actionButton.onblur = event => this.handleEvent(event);
actionButton.onfocus = event => this.handleEvent(event);
this.updateButton(node, this.action.getContextData(null), true, false);
},
@ -411,13 +392,9 @@ this.browserAction = class extends ExtensionAPIPersistent {
return;
}
// Open the unified extensions context menu when the pref is enabled.
// This context menu only has the relevant menu items for the unified
// extensions UI.
// Open the unified extensions context menu.
const popup = target.ownerDocument.getElementById(
gUnifiedExtensionsEnabled
? "unified-extensions-context-menu"
: "customizationPanelItemContextMenu"
"unified-extensions-context-menu"
);
popup.openPopup(
target,
@ -526,11 +503,7 @@ this.browserAction = class extends ExtensionAPIPersistent {
}
if (this.widget.areaType == CustomizableUI.TYPE_PANEL) {
if (gUnifiedExtensionsEnabled) {
await window.gUnifiedExtensions.togglePanel();
} else {
await window.document.getElementById("nav-bar").overflowable.show();
}
await window.gUnifiedExtensions.togglePanel();
}
// This should already have been checked by callers, but acts as an
@ -663,7 +636,7 @@ this.browserAction = class extends ExtensionAPIPersistent {
let popupURL = this.action.getPopupUrl(tab);
let { node } = window.gBrowser && this.widget.forWindow(window);
if (gUnifiedExtensionsEnabled && node) {
if (node) {
node.querySelector(
".unified-extensions-item-message-deck"
).selectedIndex = window.gUnifiedExtensions.MESSAGE_DECK_INDEX_HOVER;
@ -689,7 +662,7 @@ this.browserAction = class extends ExtensionAPIPersistent {
case "blur":
case "mouseout": {
let { node } = window.gBrowser && this.widget.forWindow(window);
if (gUnifiedExtensionsEnabled && node) {
if (node) {
node.querySelector(
".unified-extensions-item-message-deck"
).selectedIndex =
@ -843,16 +816,13 @@ this.browserAction = class extends ExtensionAPIPersistent {
let button = node.querySelector(".unified-extensions-item-action-button");
let extensionTitle = tabData.title || this.extension.name;
let messages;
if (gUnifiedExtensionsEnabled) {
let policy = WebExtensionPolicy.getByID(this.extension.id);
messages = OriginControls.getStateMessageIDs({
policy,
uri: node.ownerGlobal.gBrowser.currentURI,
isAction: true,
hasPopup: !!tabData.popup,
});
}
let policy = WebExtensionPolicy.getByID(this.extension.id);
let messages = OriginControls.getStateMessageIDs({
policy,
uri: node.ownerGlobal.gBrowser.currentURI,
isAction: true,
hasPopup: !!tabData.popup,
});
let callback = () => {
// This is set on the node so that it looks good in the toolbar.
@ -866,28 +836,26 @@ this.browserAction = class extends ExtensionAPIPersistent {
{ extensionTitle }
);
if (gUnifiedExtensionsEnabled) {
button.querySelector(
".unified-extensions-item-name"
).textContent = this.extension?.name;
button.querySelector(
".unified-extensions-item-name"
).textContent = this.extension?.name;
if (messages) {
const messageDefaultElement = button.querySelector(
".unified-extensions-item-message-default"
);
node.ownerDocument.l10n.setAttributes(
messageDefaultElement,
messages.default
);
if (messages) {
const messageDefaultElement = button.querySelector(
".unified-extensions-item-message-default"
);
node.ownerDocument.l10n.setAttributes(
messageDefaultElement,
messages.default
);
const messageHoverElement = button.querySelector(
".unified-extensions-item-message-hover"
);
node.ownerDocument.l10n.setAttributes(
messageHoverElement,
messages.onHover || messages.default
);
}
const messageHoverElement = button.querySelector(
".unified-extensions-item-message-hover"
);
node.ownerDocument.l10n.setAttributes(
messageHoverElement,
messages.onHover || messages.default
);
}
if (tabData.badgeText) {
@ -938,25 +906,15 @@ this.browserAction = class extends ExtensionAPIPersistent {
`;
};
let icon16 = IconDetails.getPreferredIcon(icons, this.extension, 16).icon;
let icon32 = IconDetails.getPreferredIcon(icons, this.extension, 32).icon;
let icon64 = IconDetails.getPreferredIcon(icons, this.extension, 64).icon;
if (gUnifiedExtensionsEnabled) {
return `
return `
${getStyle("menupanel-image", icon32)}
${getStyle("menupanel-image-2x", icon64)}
${getStyle("toolbar-image", icon32)}
${getStyle("toolbar-image-2x", icon64)}
`;
}
return `
${getStyle("menupanel-image", icon16)}
${getStyle("menupanel-image-2x", icon32)}
${getStyle("toolbar-image", icon16)}
${getStyle("toolbar-image-2x", icon32)}
`;
}
/**

Просмотреть файл

@ -1,6 +0,0 @@
[DEFAULT]
tags = webextensions
prefs =
extensions.unifiedExtensions.enabled=false
[browser_unified_extensions_disabled.js]

Просмотреть файл

@ -24,12 +24,7 @@ async function testInArea(area) {
await extension.startup();
let widget = getBrowserActionWidget(extension);
let placement = CustomizableUI.getPlacementOfWidget(widget.id);
let fallbackDefaultArea = Services.prefs.getBoolPref(
"extensions.unifiedExtensions.enabled",
false
)
? CustomizableUI.AREA_ADDONS
: CustomizableUI.AREA_NAVBAR;
let fallbackDefaultArea = CustomizableUI.AREA_ADDONS;
is(
placement && placement.area,
browserAreas[area] || fallbackDefaultArea,

Просмотреть файл

@ -1028,19 +1028,3 @@ add_task(async function test_unified_extensions_item_no_pinning() {
await extension.unload();
await BrowserTestUtils.closeWindow(win);
});
add_task(async function test_non_unified_extensions_ui() {
Services.telemetry.clearEvents();
let win = await promiseDisableUnifiedExtensions();
await browseraction_popup_contextmenu_helper(win);
await browseraction_popup_contextmenu_hidden_items_helper(win);
await browseraction_popup_image_contextmenu_helper(win);
await browseraction_contextmenu_manage_extension_helper(win);
await browseraction_contextmenu_remove_extension_helper(win);
await browseraction_contextmenu_report_extension_helper(win);
await test_no_toolbar_pinning_on_builtin_helper(win);
await BrowserTestUtils.closeWindow(win);
await SpecialPowers.popPrefEnv();
});

Просмотреть файл

@ -33,17 +33,6 @@ add_task(async function testDetailsObjects() {
green: getImageData("green"),
};
const unifiedExtensionsEnabled = SpecialPowers.getBoolPref(
"extensions.unifiedExtensions.enabled",
false
);
// In each `iconDetails` entry below, and for a same resolution, we may
// expect different values (icon URLs) for `browserActionImageURL` and
// `pageActionImageURL` because browser actions use large icons (32px or
// 64px in 2x) and page actions use small icons (16px or 32px in 2x) when
// the unifiedExtensions pref is enabled.
//
// eslint-disable indent, indent-legacy
let iconDetails = [
// Only paths.
@ -103,9 +92,7 @@ add_task(async function testDetailsObjects() {
details: { path: { "19": "a.png", "38": "a-x2.png" } },
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a-x2.png")
: browser.runtime.getURL("data/a.png"),
browserActionImageURL: browser.runtime.getURL("data/a-x2.png"),
pageActionImageURL: browser.runtime.getURL("data/a.png"),
},
"2": {
@ -120,15 +107,11 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a-32.png")
: browser.runtime.getURL("data/a-16.png"),
browserActionImageURL: browser.runtime.getURL("data/a-32.png"),
pageActionImageURL: browser.runtime.getURL("data/a-16.png"),
},
"2": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a-64.png")
: browser.runtime.getURL("data/a-32.png"),
browserActionImageURL: browser.runtime.getURL("data/a-64.png"),
pageActionImageURL: browser.runtime.getURL("data/a-32.png"),
},
},
@ -202,9 +185,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? imageData.green.url
: imageData.red.url,
browserActionImageURL: imageData.green.url,
pageActionImageURL: imageData.red.url,
},
"2": {
@ -225,9 +206,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? imageData.red.url
: browser.runtime.getURL("data/a.png"),
browserActionImageURL: imageData.red.url,
pageActionImageURL: browser.runtime.getURL("data/a.png"),
},
"2": {
@ -243,9 +222,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a.png")
: imageData.red.url,
browserActionImageURL: browser.runtime.getURL("data/a.png"),
pageActionImageURL: imageData.red.url,
},
"2": {
@ -263,9 +240,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? imageData.red.url
: browser.runtime.getURL("data/a.png"),
browserActionImageURL: imageData.red.url,
pageActionImageURL: browser.runtime.getURL("data/a.png"),
},
"2": {
@ -281,9 +256,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a.png")
: imageData.red.url,
browserActionImageURL: browser.runtime.getURL("data/a.png"),
pageActionImageURL: imageData.red.url,
},
"2": {
@ -298,9 +271,7 @@ add_task(async function testDetailsObjects() {
details: { path: { "18": "a.png", "36": "a-x2.png" } },
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a-x2.png")
: browser.runtime.getURL("data/a.png"),
browserActionImageURL: browser.runtime.getURL("data/a-x2.png"),
pageActionImageURL: browser.runtime.getURL("data/a.png"),
},
"2": {
@ -313,9 +284,7 @@ add_task(async function testDetailsObjects() {
details: { path: { "16": "a.png", "30": "a-x2.png" } },
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/a-x2.png")
: browser.runtime.getURL("data/a.png"),
browserActionImageURL: browser.runtime.getURL("data/a-x2.png"),
pageActionImageURL: browser.runtime.getURL("data/a.png"),
},
"2": {
@ -328,9 +297,7 @@ add_task(async function testDetailsObjects() {
details: { path: { "16": "16.png", "100": "100.png" } },
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/100.png")
: browser.runtime.getURL("data/16.png"),
browserActionImageURL: browser.runtime.getURL("data/100.png"),
pageActionImageURL: browser.runtime.getURL("data/16.png"),
},
"2": {
@ -361,9 +328,7 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/18.svg")
: browser.runtime.getURL("data/16.svg"),
browserActionImageURL: browser.runtime.getURL("data/18.svg"),
pageActionImageURL: browser.runtime.getURL("data/16.svg"),
},
"2": {
@ -384,15 +349,11 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/36.png")
: browser.runtime.getURL("data/18.png"),
browserActionImageURL: browser.runtime.getURL("data/36.png"),
pageActionImageURL: browser.runtime.getURL("data/18.png"),
},
"2": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/128.png")
: browser.runtime.getURL("data/36.png"),
browserActionImageURL: browser.runtime.getURL("data/128.png"),
pageActionImageURL: browser.runtime.getURL("data/36.png"),
},
},
@ -414,15 +375,11 @@ add_task(async function testDetailsObjects() {
},
resolutions: {
"1": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/32.png")
: browser.runtime.getURL("data/16.png"),
browserActionImageURL: browser.runtime.getURL("data/32.png"),
pageActionImageURL: browser.runtime.getURL("data/16.png"),
},
"2": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/64.png")
: browser.runtime.getURL("data/32.png"),
browserActionImageURL: browser.runtime.getURL("data/64.png"),
pageActionImageURL: browser.runtime.getURL("data/32.png"),
},
},
@ -446,9 +403,7 @@ add_task(async function testDetailsObjects() {
pageActionImageURL: browser.runtime.getURL("data/32.png"),
},
"2": {
browserActionImageURL: unifiedExtensionsEnabled
? browser.runtime.getURL("data/128.png")
: browser.runtime.getURL("data/32.png"),
browserActionImageURL: browser.runtime.getURL("data/128.png"),
pageActionImageURL: browser.runtime.getURL("data/32.png"),
},
},

Просмотреть файл

@ -66,24 +66,6 @@ add_task(async function test_button_enabled_by_pref() {
);
});
add_task(async function test_button_disabled_by_pref() {
const anotherWindow = await promiseDisableUnifiedExtensions();
const button = anotherWindow.document.getElementById(
"unified-extensions-button"
);
is(button.hidden, true, "expected button to be hidden");
ok(
!anotherWindow.document
.getElementById("nav-bar")
.hasAttribute("unifiedextensionsbuttonshown"),
"expected no attribute on nav-bar"
);
await BrowserTestUtils.closeWindow(anotherWindow);
await SpecialPowers.popPrefEnv();
});
add_task(async function test_open_panel_on_button_click() {
const extensions = createExtensions([
{ name: "Extension #1" },

Просмотреть файл

@ -5,26 +5,6 @@
loadTestSubscript("head_unified_extensions.js");
add_task(async function test_no_addons_themes_widget() {
if (!gUnifiedExtensions.isEnabled) {
ok(true, "Skip task because Unified Extensions UI is disabled");
return;
}
const addonsAndThemesWidgetId = "add-ons-button";
// Add the button to the navbar, which should not do anything because the
// add-ons and themes button should not exist when the unified extensions
// pref is enabled.
CustomizableUI.addWidgetToArea(
addonsAndThemesWidgetId,
CustomizableUI.AREA_NAVBAR
);
let addonsButton = document.getElementById(addonsAndThemesWidgetId);
is(addonsButton, null, "expected no add-ons and themes button");
});
/**
* Tests that if the addons panel is somehow open when customization mode is
* invoked, that the panel is hidden.

Просмотреть файл

@ -1,21 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_addons_themes_widget() {
const addonsAndThemesWidgetId = "add-ons-button";
ok(
!Services.prefs.getBoolPref("extensions.unifiedExtensions.enabled", false),
"expected unified extensions pref to be disabled"
);
CustomizableUI.addWidgetToArea(
addonsAndThemesWidgetId,
CustomizableUI.AREA_NAVBAR
);
let addonsButton = document.getElementById(addonsAndThemesWidgetId);
ok(addonsButton, "expected add-ons and themes button");
});

Просмотреть файл

@ -128,12 +128,3 @@ const verifyPermissionsPrompt = async (win, expectedAnchorID) => {
add_task(async function test_permissions_prompt_with_pref_enabled() {
await verifyPermissionsPrompt(win, "unified-extensions-button");
});
add_task(async function test_permissions_prompt_with_pref_disabled() {
const anotherWindow = await promiseDisableUnifiedExtensions();
await verifyPermissionsPrompt(anotherWindow, "addons-notification-icon");
await BrowserTestUtils.closeWindow(anotherWindow);
await SpecialPowers.popPrefEnv();
});

Просмотреть файл

@ -490,48 +490,6 @@ add_task(async function test_overflowable_toolbar() {
await BrowserTestUtils.closeWindow(win);
});
/**
* Tests that if Unified Extensions are disabled, all overflowed items
* in the toolbar go to the default overflow panel.
*/
add_task(async function test_overflowable_toolbar_legacy() {
let win = await promiseDisableUnifiedExtensions();
await withWindowOverflowed(win, {
whenOverflowed: async (defaultList, unifiedExtensionList, extensionIDs) => {
// First, ensure that all default items are in the default overflow list.
// (though there might be more items from the nav-bar in there that
// already existed in the nav-bar before we put the default widgets in
// there as well).
const defaultListIDs = getChildrenIDs(defaultList);
for (const widgetID of DEFAULT_WIDGET_IDS) {
Assert.ok(
defaultListIDs.includes(widgetID),
`Default overflow list should have ${widgetID}`
);
}
// Next, ensure that all of the browser_action buttons from the
// WebExtensions are there as well.
for (const extensionID of extensionIDs) {
const widget = defaultList.querySelector(
`[data-extensionid='${extensionID}']`
);
Assert.ok(widget, `Default list should have ${extensionID}`);
await verifyExtensionWidget(win, widget, false);
}
Assert.equal(
unifiedExtensionList.children.length,
0,
"Unified Extension overflow list should be empty."
);
},
});
await BrowserTestUtils.closeWindow(win);
await SpecialPowers.popPrefEnv();
});
add_task(async function test_context_menu() {
let win = await promiseEnableUnifiedExtensions();

Просмотреть файл

@ -10,26 +10,13 @@
getUnifiedExtensionsItem,
openExtensionsPanel,
openUnifiedExtensionsContextMenu,
promiseDisableUnifiedExtensions,
promiseEnableUnifiedExtensions
*/
const promiseEnableUnifiedExtensions = async (options = {}) => {
await SpecialPowers.pushPrefEnv({
set: [["extensions.unifiedExtensions.enabled", true]],
});
return BrowserTestUtils.openNewBrowserWindow(options);
};
const promiseDisableUnifiedExtensions = async () => {
await SpecialPowers.pushPrefEnv({
set: [["extensions.unifiedExtensions.enabled", false]],
});
return BrowserTestUtils.openNewBrowserWindow();
};
const getListView = win => {
const { panel } = win.gUnifiedExtensions;
ok(panel, "expected panel to be created");

Просмотреть файл

@ -224,39 +224,4 @@ var tests = [
"Highlight should be shown after showHighlight() for fixed panel items"
);
},
function test_info_move_outside_panel(done) {
gContentAPI.showInfo("addons", "test title", "test text");
gContentAPI.showHighlight("urlbar");
let addonsButton = document.getElementById("add-ons-button");
waitForPopupAtAnchor(
tooltip,
addonsButton,
function checkPanelIsOpen() {
isnot(PanelUI.panel.state, "closed", "Panel should have opened");
// Move the info panel outside which should close the app menu.
gContentAPI.showInfo("appMenu", "Cool menu button", "It's three lines");
waitForPopupAtAnchor(
tooltip,
document.getElementById("PanelUI-button"),
() => {
isnot(
PanelUI.panel.state,
"open",
"Menu should have closed after the highlight moved elsewhere."
);
is(
highlight.parentElement.state,
"open",
"The highlight should have remained visible"
);
done();
},
"Tooltip should move to the appMenu button and still be visible"
);
},
"Tooltip should be shown after showInfo() for a panel item"
);
},
];

Просмотреть файл

@ -759,12 +759,6 @@ repair-text-encoding-button =
## Customize Toolbar Buttons
# Variables:
# $shortcut (String): keyboard shortcut to open the add-ons manager
toolbar-addons-themes-button =
.label = Add-ons and themes
.tooltiptext = Manage your add-ons and themes ({ $shortcut })
# Variables:
# $shortcut (String): keyboard shortcut to open settings (only on macOS)
toolbar-settings-button =

Просмотреть файл

@ -231,10 +231,6 @@ toolbar {
list-style-image: url("chrome://browser/skin/downloads/downloads.svg");
}
#add-ons-button {
list-style-image: url("chrome://mozapps/skin/extensions/extension.svg");
}
#open-file-button {
list-style-image: url("chrome://browser/skin/open.svg");
}

Просмотреть файл

@ -1953,9 +1953,6 @@ pref("extensions.eventPages.enabled", true);
pref("extensions.manifestV2.actionsPopupURLRestricted", false);
// Whether "manifest_version: 3" extensions should be allowed to install successfully.
pref("extensions.manifestV3.enabled", true);
// Whether to enable the unified extensions feature. Note that this pref is
// enabled for Firefox Desktop in `browser/app/profile/firefox.js`.
pref("extensions.unifiedExtensions.enabled", false);
// Whether to enable the updated openPopup API.
#ifdef NIGHTLY_BUILD
pref("extensions.openPopupWithoutUserGesture.enabled", true);

Просмотреть файл

@ -29,13 +29,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"gUnifiedExtensionsEnabled",
"extensions.unifiedExtensions.enabled",
false
);
function parseColor(color, kind) {
if (typeof color == "string") {
let rgba = InspectorUtils.colorToRGBA(color);
@ -519,8 +512,7 @@ class BrowserActionBase extends PanelActionBase {
extension.manifest.browser_action || extension.manifest.action;
super(options, tabContext, extension);
let fallbackArea = lazy.gUnifiedExtensionsEnabled ? "menupanel" : "navbar";
let default_area = options.default_area || fallbackArea;
let default_area = options.default_area || "menupanel";
this.defaults = {
...this.defaults,

Просмотреть файл

@ -65,7 +65,7 @@ async function waitForProgressNotification(
aPanelOpen = false,
aExpectedCount = 1,
wantDisabled = true,
expectedAnchorID = "addons-notification-icon",
expectedAnchorID = "unified-extensions-button",
win = window
) {
let notificationId = PROGRESS_NOTIFICATION;
@ -220,7 +220,7 @@ function acceptAppMenuNotificationWhenShown(
async function waitForNotification(
aId,
aExpectedCount = 1,
expectedAnchorID = "addons-notification-icon",
expectedAnchorID = "unified-extensions-button",
win = window
) {
info("Waiting for " + aId + " notification");
@ -1187,7 +1187,7 @@ var TESTS = [
let notification = panel.childNodes[0];
// Close the notification
let anchor = document.getElementById("addons-notification-icon");
let anchor = document.getElementById("unified-extensions-button");
anchor.click();
// Reopen the notification
anchor.click();
@ -1468,10 +1468,7 @@ var TESTS = [
async function test_blockedInstallDomain_with_unified_extensions() {
await SpecialPowers.pushPrefEnv({
set: [
["extensions.unifiedExtensions.enabled", true],
["extensions.install_origins.enabled", true],
],
set: [["extensions.install_origins.enabled", true]],
});
let win = await BrowserTestUtils.openNewBrowserWindow();
@ -1509,7 +1506,6 @@ var TESTS = [
async function test_mv3_installOrigins_disallowed_with_unified_extensions() {
await SpecialPowers.pushPrefEnv({
set: [
["extensions.unifiedExtensions.enabled", true],
// Disable signature check because we load an unsigned MV3 extension.
["xpinstall.signatures.required", false],
["extensions.install_origins.enabled", true],
@ -1544,7 +1540,6 @@ var TESTS = [
async function test_mv3_installOrigins_allowed_with_unified_extensions() {
await SpecialPowers.pushPrefEnv({
set: [
["extensions.unifiedExtensions.enabled", true],
// Disable signature check because we load an unsigned MV3 extension.
["xpinstall.signatures.required", false],
// When this pref is disabled, install should be possible.
@ -1616,10 +1611,6 @@ add_task(async function() {
["extensions.InstallTriggerImpl.enabled", true],
// Relax the user input requirements while running this test.
["xpinstall.userActivation.required", false],
// This is needed to allow most of the tests to pass no matter the value
// of this pref. In the future, we'll want to enable this pref by default
// and adjust the assertions on the anchor IDs.
["extensions.unifiedExtensions.enabled", false],
],
});