Bug 1943208 - Allow callout primary CTA to flip multiple prefs and open the chatbot panel r=sidebar-reviewers,sclements

Reopen panel if one was open when toggling revamp and still available. This avoids race condition of trying to open chatbot and flip revamp at the same time.

Differential Revision: https://phabricator.services.mozilla.com/D245367
This commit is contained in:
Ed Lee
2025-04-14 14:23:39 +00:00
parent 5acaa33ed6
commit 26865b29fa
2 changed files with 37 additions and 7 deletions

View File

@@ -203,13 +203,15 @@ var SidebarController = {
}
);
this._sidebars.set("viewCustomizeSidebar", {
url: "chrome://browser/content/sidebar/sidebar-customize.html",
revampL10nId: "sidebar-menu-customize-label",
iconUrl: "chrome://global/skin/icons/settings.svg",
gleanEvent: Glean.sidebarCustomize.panelToggle,
visible: false,
});
if (this.sidebarRevampEnabled) {
this._sidebars.set("viewCustomizeSidebar", {
url: "chrome://browser/content/sidebar/sidebar-customize.html",
revampL10nId: "sidebar-menu-customize-label",
iconUrl: "chrome://global/skin/icons/settings.svg",
gleanEvent: Glean.sidebarCustomize.panelToggle,
visible: false,
});
}
return this._sidebars;
},
@@ -801,10 +803,16 @@ var SidebarController = {
}
if (!this._sidebars.get(this.lastOpenedId)) {
this.lastOpenedId = this.DEFAULT_SIDEBAR_ID;
wasOpen = false;
}
this.updateToolbarButton();
this._inited = false;
this.init();
// Reopen the panel in the new or old sidebar now that we've inited
if (wasOpen) {
this.toggle();
}
},
/**