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.