diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 72dfd3738b71..9f22b5855e57 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4563,12 +4563,6 @@ function updateFileMenuUserContextUIVisibility(id) {
menu.setAttribute("disabled", "true");
}
}
-function updateTabMenuUserContextUIVisibility(id) {
- let menu = document.getElementById(id);
- // Visibility of Tab menu item can change frequently.
- menu.hidden = !Services.prefs.getBoolPref("privacy.userContext.enabled", false) ||
- PrivateBrowsingUtils.isWindowPrivate(window);
-}
/**
* Updates the User Context UI indicators if the browser is in a non-default context
@@ -4601,44 +4595,6 @@ function updateUserContextUIIndicator() {
hbox.hidden = false;
}
-/**
- * Fill 'Reopen in Container' menu.
- */
-function createReopenInContainerMenu(event) {
- let currentid = TabContextMenu.contextTab.getAttribute("usercontextid");
-
- return createUserContextMenu(event, {
- isContextMenu: true,
- excludeUserContextId: currentid,
- });
-}
-
-/**
- * Reopen the tab in another container.
- */
-function reopenInContainer(event) {
- let userContextId = parseInt(event.target.getAttribute("data-usercontextid"));
- let currentTab = TabContextMenu.contextTab;
- let isSelected = (gBrowser.selectedTab == currentTab);
- let uri = currentTab.linkedBrowser.currentURI.spec;
-
- let newTab = gBrowser.addTab(uri, {
- userContextId,
- pinned: currentTab.pinned,
- index: currentTab._tPos + 1,
- });
-
- // Carry over some configuration.
- if (isSelected) {
- gBrowser.selectedTab = newTab;
- }
- if (currentTab.muted) {
- if (!newTab.muted) {
- newTab.toggleMuteAudio(currentTab.muteReason);
- }
- }
-}
-
/**
* Makes the Character Encoding menu enabled or disabled as appropriate.
* To be called when the View menu or the app menu is opened.
@@ -7843,136 +7799,6 @@ var MenuTouchModeObserver = {
},
};
-var TabContextMenu = {
- contextTab: null,
- _updateToggleMuteMenuItems(aTab, aConditionFn) {
- ["muted", "soundplaying"].forEach(attr => {
- if (!aConditionFn || aConditionFn(attr)) {
- if (aTab.hasAttribute(attr)) {
- aTab.toggleMuteMenuItem.setAttribute(attr, "true");
- aTab.toggleMultiSelectMuteMenuItem.setAttribute(attr, "true");
- } else {
- aTab.toggleMuteMenuItem.removeAttribute(attr);
- aTab.toggleMultiSelectMuteMenuItem.removeAttribute(attr);
- }
- }
- });
- },
- updateContextMenu: function updateContextMenu(aPopupMenu) {
- this.contextTab = aPopupMenu.triggerNode.localName == "tab" ?
- aPopupMenu.triggerNode : gBrowser.selectedTab;
- let disabled = gBrowser.tabs.length == 1;
- let multiselectionContext = this.contextTab.multiselected;
-
- var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple");
- for (let menuItem of menuItems)
- menuItem.disabled = disabled;
-
- if (this.contextTab.hasAttribute("customizemode"))
- document.getElementById("context_openTabInWindow").disabled = true;
-
- disabled = gBrowser.visibleTabs.length == 1;
- menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple-visible");
- for (let menuItem of menuItems)
- menuItem.disabled = disabled;
-
- // Session store
- document.getElementById("context_undoCloseTab").disabled =
- SessionStore.getClosedTabCount(window) == 0;
-
- // Only one of Reload_Tab/Reload_Selected_Tabs should be visible.
- document.getElementById("context_reloadTab").hidden = multiselectionContext;
- document.getElementById("context_reloadSelectedTabs").hidden = !multiselectionContext;
-
- // Only one of pin/unpin/multiselect-pin/multiselect-unpin should be visible
- let contextPinTab = document.getElementById("context_pinTab");
- contextPinTab.hidden = this.contextTab.pinned || multiselectionContext;
- let contextUnpinTab = document.getElementById("context_unpinTab");
- contextUnpinTab.hidden = !this.contextTab.pinned || multiselectionContext;
- let contextPinSelectedTabs = document.getElementById("context_pinSelectedTabs");
- contextPinSelectedTabs.hidden = this.contextTab.pinned || !multiselectionContext;
- let contextUnpinSelectedTabs = document.getElementById("context_unpinSelectedTabs");
- contextUnpinSelectedTabs.hidden = !this.contextTab.pinned || !multiselectionContext;
-
- // Disable "Close Tabs to the Right" if there are no tabs
- // following it.
- document.getElementById("context_closeTabsToTheEnd").disabled =
- gBrowser.getTabsToTheEndFrom(this.contextTab).length == 0;
-
- // Disable "Close other Tabs" if there are no unpinned tabs.
- let unpinnedTabsToClose = gBrowser.visibleTabs.length - gBrowser._numPinnedTabs;
- if (!this.contextTab.pinned) {
- unpinnedTabsToClose--;
- }
- document.getElementById("context_closeOtherTabs").disabled = unpinnedTabsToClose < 1;
-
- // Only one of close_tab/close_selected_tabs should be visible
- document.getElementById("context_closeTab").hidden = multiselectionContext;
- document.getElementById("context_closeSelectedTabs").hidden = !multiselectionContext;
-
- // Hide "Bookmark All Tabs" for a pinned tab. Update its state if visible.
- let bookmarkAllTabs = document.getElementById("context_bookmarkAllTabs");
- bookmarkAllTabs.hidden = this.contextTab.pinned;
- if (!bookmarkAllTabs.hidden)
- PlacesCommandHook.updateBookmarkAllTabsCommand();
-
- let toggleMute = document.getElementById("context_toggleMuteTab");
- let toggleMultiSelectMute = document.getElementById("context_toggleMuteSelectedTabs");
-
- // Only one of mute_unmute_tab/mute_unmute_selected_tabs should be visible
- toggleMute.hidden = multiselectionContext;
- toggleMultiSelectMute.hidden = !multiselectionContext;
-
- // Adjust the state of the toggle mute menu item.
- if (this.contextTab.hasAttribute("activemedia-blocked")) {
- toggleMute.label = gNavigatorBundle.getString("playTab.label");
- toggleMute.accessKey = gNavigatorBundle.getString("playTab.accesskey");
- } else if (this.contextTab.hasAttribute("muted")) {
- toggleMute.label = gNavigatorBundle.getString("unmuteTab.label");
- toggleMute.accessKey = gNavigatorBundle.getString("unmuteTab.accesskey");
- } else {
- toggleMute.label = gNavigatorBundle.getString("muteTab.label");
- toggleMute.accessKey = gNavigatorBundle.getString("muteTab.accesskey");
- }
-
- // Adjust the state of the toggle mute menu item for multi-selected tabs.
- if (this.contextTab.hasAttribute("activemedia-blocked")) {
- toggleMultiSelectMute.label = gNavigatorBundle.getString("playTabs.label");
- toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("playTabs.accesskey");
- } else if (this.contextTab.hasAttribute("muted")) {
- toggleMultiSelectMute.label = gNavigatorBundle.getString("unmuteSelectedTabs.label");
- toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("unmuteSelectedTabs.accesskey");
- } else {
- toggleMultiSelectMute.label = gNavigatorBundle.getString("muteSelectedTabs.label");
- toggleMultiSelectMute.accessKey = gNavigatorBundle.getString("muteSelectedTabs.accesskey");
- }
-
- this.contextTab.toggleMuteMenuItem = toggleMute;
- this.contextTab.toggleMultiSelectMuteMenuItem = toggleMultiSelectMute;
- this._updateToggleMuteMenuItems(this.contextTab);
-
- this.contextTab.addEventListener("TabAttrModified", this);
- aPopupMenu.addEventListener("popuphiding", this);
-
- gSync.updateTabContextMenu(aPopupMenu, this.contextTab);
-
- updateTabMenuUserContextUIVisibility("context_reopenInContainer");
- },
- handleEvent(aEvent) {
- switch (aEvent.type) {
- case "popuphiding":
- gBrowser.removeEventListener("TabAttrModified", this);
- aEvent.target.removeEventListener("popuphiding", this);
- break;
- case "TabAttrModified":
- let tab = aEvent.target;
- this._updateToggleMuteMenuItems(tab,
- attr => aEvent.detail.changed.includes(attr));
- break;
- }
- }
-};
-
// Prompt user to restart the browser in safe mode
function safeModeRestart() {
if (Services.appinfo.inSafeMode) {
diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul
index 8397e1a6873a..922efe9732c6 100644
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -114,8 +114,8 @@
label="&reopenInContainer.label;"
accesskey="&reopenInContainer.accesskey;"
hidden="true">
-
+