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 | |
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')
4 files changed, 32 insertions, 63 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); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about_default_pin_promo.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about_default_pin_promo.js index bc62556b12..d34b93f4de 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about_default_pin_promo.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_about_default_pin_promo.js @@ -54,57 +54,3 @@ add_task(async function test_pin_promo() { await BrowserTestUtils.closeWindow(win3); await BrowserTestUtils.closeWindow(win4); }); - -add_task(async function test_pin_promo_mr2022_holdback() { - ASRouter.resetMessageState(); - // Set majorRelease2022 feature onboarding variable fallback pref - // for inMr2022Holdback targeting to evaluate true - await SpecialPowers.pushPrefEnv({ - set: [["browser.majorrelease.onboarding", false]], - }); - await ASRouter.onPrefChange(); - let { win: win1, tab: tab1 } = await openTabAndWaitForRender(); - - await SpecialPowers.spawn(tab1, [], async function () { - const promoContainer = content.document.querySelector(".promo"); - const promoButton = content.document.querySelector( - "#private-browsing-promo-link" - ); - - ok(promoContainer, "Promo is shown"); - - Assert.equal( - promoButton.getAttribute("data-l10n-id"), - "about-private-browsing-focus-promo-cta", - "Pin Promo not shown for holdback user" - ); - }); - - await BrowserTestUtils.closeWindow(win1); -}); - -add_task(async function test_pin_promo_mr2022_not_holdback() { - ASRouter.resetMessageState(); - // Set majorRelease2022 feature onboarding variable fallback pref - // for inMr2022Holdback targeting to evaluate false - await SpecialPowers.pushPrefEnv({ - set: [["browser.majorrelease.onboarding", true]], - }); - await ASRouter.onPrefChange(); - let { win: win1, tab: tab1 } = await openTabAndWaitForRender(); - - await SpecialPowers.spawn(tab1, [], async function () { - const promoContainer = content.document.querySelector(".promo"); - const promoHeader = content.document.getElementById("promo-header"); - - ok(promoContainer, "Promo is shown"); - - is( - promoHeader.getAttribute("data-l10n-id"), - "about-private-browsing-pin-promo-header", - "Pin Promo is shown" - ); - }); - - await BrowserTestUtils.closeWindow(win1); -}); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_resetPBM.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_resetPBM.js index a80d818c87..f443b9bcd9 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_resetPBM.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_resetPBM.js @@ -682,23 +682,23 @@ add_task(async function test_reset_action_closes_sidebar() { info( "Open the sidebar of both the private browsing window and the normal browsing window." ); - await SidebarUI.show("viewBookmarksSidebar"); - await win.SidebarUI.show("viewBookmarksSidebar"); + await SidebarController.show("viewBookmarksSidebar"); + await win.SidebarController.show("viewBookmarksSidebar"); info("Trigger the restart PBM action"); await ResetPBMPanel._restartPBM(win); Assert.ok( - SidebarUI.isOpen, + SidebarController.isOpen, "Normal browsing window sidebar should still be open." ); Assert.ok( - !win.SidebarUI.isOpen, + !win.SidebarController.isOpen, "Private browsing sidebar should be closed." ); // Cleanup: Close the sidebar of the normal browsing window. - SidebarUI.hide(); + SidebarController.hide(); // Cleanup: Close the private window that remained open. await BrowserTestUtils.closeWindow(win); diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js index 58a333bfdb..9988f35969 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_sidebar.js @@ -12,7 +12,7 @@ function test() { // opens a sidebar function openSidebar(win) { - return win.SidebarUI.show("viewBookmarksSidebar").then(() => win); + return win.SidebarController.show("viewBookmarksSidebar").then(() => win); } let windowCache = []; |