Bug 1865154 - Add check for activeIndex in tabState.entries r=sessionstore-reviewers,sfoster
* Only add previously open tabs to the newWindowState in _prepDataForDeferredRestore if they have entries Differential Revision: https://phabricator.services.mozilla.com/D196157
This commit is contained in:
@@ -6532,27 +6532,29 @@ var SessionStoreInternal = {
|
|||||||
activeIndex = Math.min(activeIndex, tabState.entries.length - 1);
|
activeIndex = Math.min(activeIndex, tabState.entries.length - 1);
|
||||||
activeIndex = Math.max(activeIndex, 0);
|
activeIndex = Math.max(activeIndex, 0);
|
||||||
|
|
||||||
let title =
|
if (activeIndex in tabState.entries) {
|
||||||
tabState.entries[activeIndex].title ||
|
let title =
|
||||||
tabState.entries[activeIndex].url;
|
tabState.entries[activeIndex].title ||
|
||||||
|
tabState.entries[activeIndex].url;
|
||||||
|
|
||||||
let tabData = {
|
let tabData = {
|
||||||
state: tabState,
|
state: tabState,
|
||||||
title,
|
title,
|
||||||
image: tabState.image,
|
image: tabState.image,
|
||||||
pos: tIndex,
|
pos: tIndex,
|
||||||
closedAt: Date.now(),
|
closedAt: Date.now(),
|
||||||
closedInGroup: false,
|
closedInGroup: false,
|
||||||
removeAfterRestore: true,
|
removeAfterRestore: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this._shouldSaveTabState(tabState)) {
|
if (this._shouldSaveTabState(tabState)) {
|
||||||
this.saveClosedTabData(
|
this.saveClosedTabData(
|
||||||
window,
|
window,
|
||||||
newWindowState._closedTabs,
|
newWindowState._closedTabs,
|
||||||
tabData,
|
tabData,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tIndex++;
|
tIndex++;
|
||||||
|
|||||||
Reference in New Issue
Block a user