Bug 1711519 - remove trivial gProton and gProtonDoorhangers checks, r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D116630
This commit is contained in:
Gijs Kruitbosch 2021-06-03 11:41:54 +00:00
parent a5de5d21cf
commit a9281aec97
8 changed files with 11 additions and 112 deletions

View File

@ -138,12 +138,6 @@ var gTabsPanel = {
showAllTabsPanel(event) {
this.init();
if (this.canOpen) {
if (!gProton) {
PanelMultiView.getViewNode(
document,
"allTabsMenu-searchTabs"
).classList.add("subviewbutton-iconic");
}
PanelUI.showSubView(
this.kElements.allTabsView,
this.allTabsButton,

View File

@ -623,15 +623,15 @@ var BrowserPageActions = {
urlbarNode,
disabled = action.getDisabled(window)
) {
// When Proton is enabled, the extension page actions should behave similarly
// to a transient action, and be hidden from the urlbar overflow menu if they
// Extension page actions should behave like a transient action,
// and be hidden from the urlbar overflow menu if they
// are disabled (as in the urlbar when the overflow menu isn't available)
//
// TODO(Bug 1704139): as a follow up we may look into just set on all
// extension pageActions `_transient: true`, at least once we sunset
// the proton preference and we don't need the pre-Proton behavior anymore,
// and remove this special case.
const isProtonExtensionAction = action.extensionID && gProton;
const isProtonExtensionAction = action.extensionID;
if (action.__transient || isProtonExtensionAction) {
this.placeActionInPanel(action);
@ -942,11 +942,8 @@ var BrowserPageActions = {
}
let action = this.actionForNode(popup.triggerNode);
if (
!action ||
// In Proton, only extension actions provide a context menu.
(gProton && !action.extensionID)
) {
// Only extension actions provide a context menu.
if (!action?.extensionID) {
this._contextAction = null;
event.preventDefault();
return;

View File

@ -1687,10 +1687,6 @@ var BookmarkingUI = {
entry: "subviewbutton",
};
if (!gProtonDoorhangers) {
extraClasses.footer = "panel-subview-footer";
}
new PlacesMenu(event, `place:parent=${PlacesUtils.bookmarks.menuGuid}`, {
extraClasses,
insertionPoint: ".panel-subview-footer-button",

View File

@ -573,14 +573,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
/* Temporary pref while the Proton doorhangers work stablizes. */
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gProtonDoorhangers",
"browser.proton.doorhangers.enabled",
false
);
customElements.setElementCreationCallback("translation-notification", () => {
Services.scriptloader.loadSubScript(
"chrome://browser/content/translation-notification.js",
@ -7540,7 +7532,7 @@ var IndexedDBPromptHelper = {
Ci.nsIPermissionManager.ALLOW_ACTION
);
},
disableHighlight: gProtonDoorhangers,
disableHighlight: true,
};
var secondaryActions = [
@ -7639,7 +7631,7 @@ var CanvasPermissionPromptHelper = {
state && state.checkboxChecked
);
},
disableHighlight: gProtonDoorhangers,
disableHighlight: true,
};
let secondaryActions = [
@ -7813,9 +7805,7 @@ var WebAuthnPromptHelper = {
}
};
if (gProtonDoorhangers) {
mainAction.disableHighlight = true;
}
mainAction.disableHighlight = true;
this._tid = tid;
this._current = PopupNotifications.show(

View File

@ -7172,11 +7172,8 @@ var TabContextMenu = {
updateShareURLMenuItem() {
// We only support "share URL" on macOS and on Windows 10:
if (
!gProton ||
!(
AppConstants.platform == "macosx" ||
AppConstants.isPlatformAndVersionAtLeast("win", "6.4")
)
AppConstants.platform != "macosx" &&
!AppConstants.isPlatformAndVersionAtLeast("win", "6.4")
) {
return;
}

View File

@ -65,12 +65,6 @@ XPCOMUtils.defineLazyGetter(this, "gWidgetsBundle", function() {
"chrome://browser/locale/customizableui/customizableWidgets.properties";
return Services.strings.createBundle(kUrl);
});
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gProton",
"browser.proton.enabled",
false
);
XPCOMUtils.defineLazyServiceGetter(
this,
"gTouchBarUpdater",
@ -255,21 +249,6 @@ CustomizeMode.prototype = {
}
},
async _updateThemeButtonIcon() {
// Keep the default button icon.
if (gProton) {
return;
}
let lwthemeButton = this.$("customization-lwtheme-button");
let lwthemeIcon = lwthemeButton.icon;
let theme = (await AddonManager.getAddonsByTypes(["theme"])).find(
addon => addon.isActive
);
lwthemeIcon.style.backgroundImage =
theme && theme.iconURL ? "url(" + theme.iconURL + ")" : "";
},
setTab(aTab) {
if (gTab == aTab) {
return;
@ -463,7 +442,6 @@ CustomizeMode.prototype = {
}, 0);
this._updateEmptyPaletteNotice();
this._updateThemeButtonIcon();
AddonManager.addAddonListener(this);
this._setupDownloadAutoHideToggle();
@ -1825,7 +1803,6 @@ CustomizeMode.prototype = {
return;
}
await this._updateThemeButtonIcon();
if (this._nextThemeChangeUserTriggered) {
this._onUIChange();
}

View File

@ -74,58 +74,6 @@ add_UITour_task(async function test_availableTargets_search() {
}
});
add_UITour_task(
async function test_availableTargets_removeUrlbarPageActionsAll() {
if (gProton) {
ok(
true,
"In proton actions cannot be removed from or added to the URL bar."
);
return;
}
pageActionsHelper.setActionsUrlbarState(false);
UITour.clearAvailableTargetsCache();
let data = await getConfigurationPromise("availableTargets");
let expecteds = getExpectedTargets();
ok_targets(data, expecteds);
let expectedActions = [
["pageAction-bookmark", "pageAction-panel-bookmark"],
["pageAction-copyURL", "pageAction-panel-copyURL"],
["pageAction-emailLink", "pageAction-panel-emailLink"],
["pageAction-sendToDevice", "pageAction-panel-sendToDevice"],
];
for (let [targetName, expectedNodeId] of expectedActions) {
await assertTargetNode(targetName, expectedNodeId);
}
pageActionsHelper.restoreActionsUrlbarState();
}
);
add_UITour_task(async function test_availableTargets_addUrlbarPageActionsAll() {
if (gProton) {
ok(
true,
"In proton actions cannot be removed from or added to the URL bar."
);
return;
}
pageActionsHelper.setActionsUrlbarState(true);
UITour.clearAvailableTargetsCache();
let data = await getConfigurationPromise("availableTargets");
let expecteds = getExpectedTargets();
ok_targets(data, expecteds);
let expectedActions = [
["pageAction-bookmark", "star-button-box"],
["pageAction-copyURL", "pageAction-urlbar-copyURL"],
["pageAction-emailLink", "pageAction-urlbar-emailLink"],
["pageAction-sendToDevice", "pageAction-urlbar-sendToDevice"],
];
for (let [targetName, expectedNodeId] of expectedActions) {
await assertTargetNode(targetName, expectedNodeId);
}
pageActionsHelper.restoreActionsUrlbarState();
});
function ok_targets(actualData, expectedTargets) {
// Depending on how soon after page load this is called, the selected tab icon
// may or may not be showing the loading throbber. We can't be sure whether

View File

@ -1185,7 +1185,7 @@ add_task(async function transient() {
Assert.equal(onPlacedInPanelCount, 0, "onPlacedInPanelCount should remain 0");
Assert.equal(
onBeforePlacedInWindowCount,
gProton ? 1 : 0,
1,
"onBeforePlacedInWindowCount after adding transient action"
);