mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
fix: Fixed restoring previous tab on other workspaces, b=(no-bug), c=compact-mode, workspaces
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
index 5633e5032f5d50c70512187d27e045b579978927..6b9e56cb62a4812925ff812763ea9b0e6a478202 100644
|
||||
index 5633e5032f5d50c70512187d27e045b579978927..01df61b55b427212a61e6bc2de8c1df612055e1b 100644
|
||||
--- a/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
|
||||
@@ -2081,7 +2081,6 @@ var SessionStoreInternal = {
|
||||
@@ -68,7 +68,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..6b9e56cb62a4812925ff812763ea9b0e
|
||||
continue;
|
||||
}
|
||||
let tabData = lazy.TabState.collect(tab, TAB_CUSTOM_VALUES.get(tab));
|
||||
@@ -5442,7 +5443,7 @@ var SessionStoreInternal = {
|
||||
@@ -5442,10 +5443,13 @@ var SessionStoreInternal = {
|
||||
// We don't store the Firefox View tab in Session Store, so if it was the last selected "tab" when
|
||||
// a window is closed, point to the first item in the tab strip instead (it will never be the Firefox View tab,
|
||||
// since it's only inserted into the tab strip after it's selected).
|
||||
@@ -77,7 +77,13 @@ index 5633e5032f5d50c70512187d27e045b579978927..6b9e56cb62a4812925ff812763ea9b0e
|
||||
selectedIndex = 1;
|
||||
winData.title = tabbrowser.tabs[0].label;
|
||||
}
|
||||
@@ -5599,6 +5600,7 @@ var SessionStoreInternal = {
|
||||
+ if (!tabbrowser.selectedTab.pinned) {
|
||||
+ selectedIndex += 1;
|
||||
+ }
|
||||
winData.selected = selectedIndex;
|
||||
|
||||
this._updateWindowFeatures(aWindow);
|
||||
@@ -5599,6 +5603,7 @@ var SessionStoreInternal = {
|
||||
winData.tabs,
|
||||
winData.groups ?? []
|
||||
);
|
||||
@@ -85,7 +91,7 @@ index 5633e5032f5d50c70512187d27e045b579978927..6b9e56cb62a4812925ff812763ea9b0e
|
||||
this._log.debug(
|
||||
`restoreWindow, createTabsForSessionRestore returned ${tabs.length} tabs`
|
||||
);
|
||||
@@ -6148,8 +6150,23 @@ var SessionStoreInternal = {
|
||||
@@ -6148,8 +6153,23 @@ var SessionStoreInternal = {
|
||||
|
||||
// Most of tabData has been restored, now continue with restoring
|
||||
// attributes that may trigger external events.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
index 6dece2b9d0462d90a28e75350ce983d87816ef73..642e34eb9f90f4c2581c217c8ca6e1e3f36a1e1a 100644
|
||||
index 6dece2b9d0462d90a28e75350ce983d87816ef73..fb26ba8cc858cc730c2fe7539f1d2354d2d307a9 100644
|
||||
--- a/browser/components/tabbrowser/content/tabbrowser.js
|
||||
+++ b/browser/components/tabbrowser/content/tabbrowser.js
|
||||
@@ -415,11 +415,58 @@
|
||||
@@ -376,7 +376,7 @@ index 6dece2b9d0462d90a28e75350ce983d87816ef73..642e34eb9f90f4c2581c217c8ca6e1e3
|
||||
+ if (gZenVerticalTabsManager._canReplaceNewTab) {
|
||||
+ ZenWorkspaces._tabToRemoveForEmpty = leftoverTab;
|
||||
+ if (Services.prefs.getBoolPref("zen.workspaces.continue-where-left-off")) {
|
||||
+ ZenWorkspaces._tabToSelect = tabToSelect;
|
||||
+ ZenWorkspaces._tabToSelect = selectTab - 1;
|
||||
+ }
|
||||
+ } else {
|
||||
this.selectedTab = tabToSelect;
|
||||
|
@@ -561,7 +561,7 @@ var gZenCompactModeManager = {
|
||||
_onTabOpen(event) {
|
||||
const tab = event.target;
|
||||
if (!tab.selected && this.preference && !this.isSidebarPotentiallyOpen()) {
|
||||
gZenUIManager.showToast('zen-background-tab-opened');
|
||||
gZenUIManager.showToast('zen-background-tab-opened-toast');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@@ -796,7 +796,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
let showed = false;
|
||||
if (this._initialTab) {
|
||||
if (this._initialTab._shouldRemove && this._initialTab._veryPossiblyEmpty) {
|
||||
gBrowser.removeTab(this._initialTab);
|
||||
gBrowser.removeTab(this._initialTab, {
|
||||
skipSessionStore: true,
|
||||
animate: false
|
||||
});
|
||||
} else {
|
||||
this.moveTabToWorkspace(this._initialTab, this.activeWorkspace);
|
||||
gBrowser.selectedTab = this._initialTab;
|
||||
@@ -806,12 +809,15 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||
} else if (this._tabToRemoveForEmpty) {
|
||||
if (gZenVerticalTabsManager._canReplaceNewTab) {
|
||||
if (this._tabToSelect) {
|
||||
gBrowser.selectedTab = this._tabToSelect;
|
||||
gBrowser.tabbox.selectedIndex = this._tabToSelect;
|
||||
} else {
|
||||
this.selectEmptyTab();
|
||||
showed = true;
|
||||
}
|
||||
gBrowser.removeTab(this._tabToRemoveForEmpty);
|
||||
gBrowser.removeTab(this._tabToRemoveForEmpty, {
|
||||
skipSessionStore: true,
|
||||
animate: false
|
||||
});
|
||||
}
|
||||
}
|
||||
delete this._tabToSelect;
|
||||
|
Reference in New Issue
Block a user