diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /browser/components/privatebrowsing/ResetPBMPanel.sys.mjs | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/privatebrowsing/ResetPBMPanel.sys.mjs')
-rw-r--r-- | browser/components/privatebrowsing/ResetPBMPanel.sys.mjs | 29 |
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); |