diff --git a/browser/components/customizableui/CustomizableWidgets.jsm b/browser/components/customizableui/CustomizableWidgets.jsm
index a78ea7f74f37..6cc5d8a018a0 100644
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -793,11 +793,54 @@ if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
}
},
onViewShowing(aEvent) {
+ let win = aEvent.target.ownerGlobal;
+ let doc = win.document;
+ let eventBlocker = null;
+ if (!doc.querySelector("#PanelUI-panic-timeframe")) {
+ win.MozXULElement.insertFTLIfNeeded("browser/panicButton.ftl");
+ let frag = win.MozXULElement.parseXULToFragment(`
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `);
+
+ aEvent.target.appendChild(frag);
+ eventBlocker = doc.l10n.translateElements([aEvent.target]);
+ }
+
let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
- let doc = aEvent.target.ownerDocument;
let group = doc.getElementById("PanelUI-panic-timeSpan");
group.selectedItem = doc.getElementById("PanelUI-panic-5min");
forgetButton.addEventListener("command", this);
+
+ if (eventBlocker) {
+ aEvent.detail.addBlocker(eventBlocker);
+ }
},
onViewHiding(aEvent) {
let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul
index 63d32886c183..8815adce885b 100644
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -633,34 +633,7 @@
-
-
-
-
- &panicButton.view.mainTimeframeDesc;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+