diff a/browser/components/aiwindow/ui/modules/AIWindowTabStatesManager.sys.mjs b/browser/components/aiwindow/ui/modules/AIWindowTabStatesManager.sys.mjs (rejected hunks)
@@ -709,23 +709,38 @@
const tab = this.#window.gBrowser.getTabForBrowser(browser);
let tabState = this.#tabStates.get(tab);
lazy.AIWindowUI.updateStarterPrompts(this.#window);
- if (!tabState || !tabState?.state?.conversationId) {
+ if (!tabState || !tabState.state?.conversationId) {
return;
}
+ // If the new URL is going away from fullpage mode
const isAiWindowUrl = locationURI.spec === lazy.AIWINDOW_URL;
- const isSidebarOpen = lazy.AIWindowUI.isSidebarOpen(this.#window);
- const isFullPageMode = tabState.state.mode === "fullpage";
- const shouldKeepSidebarOpen = tabState.state.keepSidebarOpen ?? true;
if (!isAiWindowUrl) {
lazy.SmartWindowTelemetry.recordUriLoad();
+
+ // The user has navigated away from the fullpage mode, record that
+ // this event has happened, at which point we should start to
+ // track/use whether the user has closed/opened the sidebar. If
+ // The user has not navigated away from the fullpage mode then the
+ // sidebar should always default to staying open. This property
+ // should only ever be set here, and should only ever be set to true.
+ tabState = this.#tabStates.get(tab, { hasNavigated: true });
}
+ const isSidebarOpen = lazy.AIWindowUI.isSidebarOpen(this.#window);
+ const isFullPageMode = tabState.state.mode === "fullpage";
+
+ // keepSidebarOpen should only take effect if the user has already
+ // navigated away from fullpage window once.
+ const shouldKeepSidebarOpen =
+ (tabState.state.hasNavigated && tabState.state.keepSidebarOpen) ??
+ true;
+
if (isFullPageMode && isAiWindowUrl && isSidebarOpen) {
lazy.AIWindowUI.closeSidebar(this.#window);
} else if (
isFullPageMode &&
!isAiWindowUrl &&
in addition, Git reported this error: while searching for:
const tab = this.#window.gBrowser.getTabForBrowser(browser);
let tabState = this.#tabStates.get(tab);
lazy.AIWindowUI.updateStarterPrompts(this.#window);
if (!tabState || !tabState?.state?.conversationId) {
return;
}
const isAiWindowUrl = locationURI.spec === lazy.AIWINDOW_URL;
const isSidebarOpen = lazy.AIWindowUI.isSidebarOpen(this.#window);
const isFullPageMode = tabState.state.mode === "fullpage";
const shouldKeepSidebarOpen = tabState.state.keepSidebarOpen ?? true;
if (!isAiWindowUrl) {
lazy.SmartWindowTelemetry.recordUriLoad();
}
if (isFullPageMode && isAiWindowUrl && isSidebarOpen) {
lazy.AIWindowUI.closeSidebar(this.#window);
} else if (
isFullPageMode &&
!isAiWindowUrl &&
Last update:
Raw error output:
Problem while applying patch in revision 290761:
Checking patch browser/components/aiwindow/ui/test/browser/browser_smartwindow_tab_switching.js...
Checking patch browser/components/aiwindow/ui/modules/AIWindowTabStatesManager.sys.mjs...
error: while searching for:
const tab = this.#window.gBrowser.getTabForBrowser(browser);
let tabState = this.#tabStates.get(tab);
lazy.AIWindowUI.updateStarterPrompts(this.#window);
if (!tabState || !tabState?.state?.conversationId) {
return;
}
const isAiWindowUrl = locationURI.spec === lazy.AIWINDOW_URL;
const isSidebarOpen = lazy.AIWindowUI.isSidebarOpen(this.#window);
const isFullPageMode = tabState.state.mode === "fullpage";
const shouldKeepSidebarOpen = tabState.state.keepSidebarOpen ?? true;
if (!isAiWindowUrl) {
lazy.SmartWindowTelemetry.recordUriLoad();
}
if (isFullPageMode && isAiWindowUrl && isSidebarOpen) {
lazy.AIWindowUI.closeSidebar(this.#window);
} else if (
isFullPageMode &&
!isAiWindowUrl &&
error: patch failed: browser/components/aiwindow/ui/modules/AIWindowTabStatesManager.sys.mjs:709
Applied patch browser/components/aiwindow/ui/test/browser/browser_smartwindow_tab_switching.js cleanly.
Applying patch browser/components/aiwindow/ui/modules/AIWindowTabStatesManager.sys.mjs with 1 reject...
Rejected hunk #1.
, by ogonzalez@mozilla.com.
Requested for uplift from
D290761
User impact: Sidebar discoverability is vital for initial release of Smart Window, it is intended that it defaults to open when navigating to a site form full page mode. This patch fixes an issue where the...
Risk: Low
Show all answers
User impact if declined/Reason for urgency
Sidebar discoverability is vital for initial release of Smart Window, it is intended that it defaults to open when navigating to a site form full page mode. This patch fixes an issue where the Smart Window sidebar doesn't default to open in scenarios where the sidebar was opened in an initial tab and then a second tab is opened (fullpage mode) and then the user navigates (should default to opening sidebar).
Additionally, this patch carries a change that will fix another uplift request for Bug 2026191
Code covered by automated testing?
Yes
Fix verified in Nightly?
Yes
Needs manual QE testing?
Yes
Steps to reproduce for manual QE testing
1. Open Smart Window
2. Navigate to a site in initial tab (sidebar should open)
3. Open a second tab
4. Navigate to another site in the second tab (sidebar should open for this tab as well)
Risk associated with taking this patch
Low
Explanation of risk level
Changes for this should only affect the sidebar state management in Smart Window.