summaryrefslogtreecommitdiffstats
path: root/browser/components/privatebrowsing/ResetPBMPanel.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/privatebrowsing/ResetPBMPanel.sys.mjs')
-rw-r--r--browser/components/privatebrowsing/ResetPBMPanel.sys.mjs29
1 files changed, 26 insertions, 3 deletions
diff --git a/browser/components/privatebrowsing/ResetPBMPanel.sys.mjs b/browser/components/privatebrowsing/ResetPBMPanel.sys.mjs
index f5e818c2a8..51bba1e6af 100644
--- a/browser/components/privatebrowsing/ResetPBMPanel.sys.mjs
+++ b/browser/components/privatebrowsing/ResetPBMPanel.sys.mjs
@@ -45,6 +45,9 @@ export const ResetPBMPanel = {
onViewShowing(aEvent) {
ResetPBMPanel.onViewShowing(aEvent);
},
+ onViewHiding(aEvent) {
+ ResetPBMPanel.onViewHiding(aEvent);
+ },
};
if (this._enabled) {
@@ -59,7 +62,8 @@ export const ResetPBMPanel = {
* the toolbar button.
*/
async onViewShowing(event) {
- let triggeringWindow = event.target.ownerGlobal;
+ let panelview = event.target;
+ let triggeringWindow = panelview.ownerGlobal;
// We may skip the confirmation panel if disabled via pref.
if (!this._shouldConfirmClear) {
@@ -68,7 +72,7 @@ export const ResetPBMPanel = {
// If the action is triggered from the overflow menu make sure that the
// panel gets hidden.
- lazy.CustomizableUI.hidePanelForNode(event.target);
+ lazy.CustomizableUI.hidePanelForNode(panelview);
// Trigger the restart action.
await this._restartPBM(triggeringWindow);
@@ -77,6 +81,8 @@ export const ResetPBMPanel = {
return;
}
+ panelview.addEventListener("command", this);
+
// Before the panel is shown, update checkbox state based on pref.
this._rememberCheck(triggeringWindow).checked = this._shouldConfirmClear;
@@ -86,6 +92,23 @@ export const ResetPBMPanel = {
});
},
+ onViewHiding(event) {
+ let panelview = event.target;
+ panelview.removeEventListener("command", this);
+ },
+
+ handleEvent(event) {
+ let button = event.target;
+ switch (button.id) {
+ case "reset-pbm-panel-cancel-button":
+ this.onCancel(button);
+ break;
+ case "reset-pbm-panel-confirm-button":
+ this.onConfirm(button);
+ break;
+ }
+ },
+
/**
* Handles the confirmation panel cancel button.
* @param {MozButton} button - Cancel button that triggered the action.
@@ -190,7 +213,7 @@ export const ResetPBMPanel = {
});
// In the remaining PBM window: If the sidebar is open close it.
- triggeringWindow.SidebarUI?.hide();
+ triggeringWindow.SidebarController?.hide();
// Clear session store data for the remaining PBM window.
lazy.SessionStore.purgeDataForPrivateWindow(triggeringWindow);