diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 8ec4c7c766e3..d407cbcc15e8 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -6128,18 +6128,7 @@ }); let tabContextFTLInserter = () => { - MozXULElement.insertFTLIfNeeded("browser/tabContextMenu.ftl"); - // Un-lazify the l10n-ids now that the FTL file has been inserted. - document - .getElementById("tabContextMenu") - .querySelectorAll("[data-lazy-l10n-id]") - .forEach(el => { - el.setAttribute( - "data-l10n-id", - el.getAttribute("data-lazy-l10n-id") - ); - el.removeAttribute("data-lazy-l10n-id"); - }); + this.translateTabContextMenu(); this.tabContainer.removeEventListener( "contextmenu", tabContextFTLInserter, @@ -6291,6 +6280,22 @@ }); }, + translateTabContextMenu() { + if (this._tabContextMenuTranslated) { + return; + } + MozXULElement.insertFTLIfNeeded("browser/tabContextMenu.ftl"); + // Un-lazify the l10n-ids now that the FTL file has been inserted. + document + .getElementById("tabContextMenu") + .querySelectorAll("[data-lazy-l10n-id]") + .forEach(el => { + el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id")); + el.removeAttribute("data-lazy-l10n-id"); + }); + this._tabContextMenuTranslated = true; + }, + setSuccessor(aTab, successorTab) { if (aTab.ownerGlobal != window) { throw new Error("Cannot set the successor of another window's tab"); diff --git a/browser/modules/TabsList.jsm b/browser/modules/TabsList.jsm index aab7956b7a52..6dae81a110b1 100644 --- a/browser/modules/TabsList.jsm +++ b/browser/modules/TabsList.jsm @@ -199,6 +199,7 @@ class TabsPanel extends TabsListBase { if (!this.listenersRegistered && event.target == this.view) { this.panelMultiView = this.view.panelMultiView; this._populate(event); + this.gBrowser.translateTabContextMenu(); } break; case "command":