@@ -6560,16 +6560,20 @@ var SessionStoreInternal = {
6560
6560
6561
6561
hasPinnedTabs ||= ! ! newWindowState . tabs . length ;
6562
6562
6563
- // Only transfer over window attributes for pinned tabs, which has
6564
- // already been extracted into newWindowState.tabs.
6565
- if ( newWindowState . tabs . length ) {
6563
+ // At this point the window in the state object has been modified (or not)
6564
+ // We want to build the rest of this new window object if we have pinnedTabs.
6565
+ if (
6566
+ newWindowState . tabs . length ||
6567
+ ( PERSIST_SESSIONS && newWindowState . _closedTabs . length )
6568
+ ) {
6569
+ // First get the other attributes off the window
6566
6570
WINDOW_ATTRIBUTES . forEach ( function ( attr ) {
6567
6571
if ( attr in window ) {
6568
6572
newWindowState [ attr ] = window [ attr ] ;
6569
6573
delete window [ attr ] ;
6570
6574
}
6571
6575
} ) ;
6572
- // We're just copying position data into the window for pinned tabs .
6576
+ // We're just copying position data into the pinned window .
6573
6577
// Not copying over:
6574
6578
// - extData
6575
6579
// - isPopup
@@ -6579,14 +6583,8 @@ var SessionStoreInternal = {
6579
6583
// remaining data
6580
6584
window . __lastSessionWindowID = newWindowState . __lastSessionWindowID =
6581
6585
"" + Date . now ( ) + Math . random ( ) ;
6582
- }
6583
6586
6584
- // If this newWindowState contains pinned tabs (stored in tabs) or
6585
- // closed tabs, add it to the defaultState so they're available immediately.
6586
- if (
6587
- newWindowState . tabs . length ||
6588
- ( PERSIST_SESSIONS && newWindowState . _closedTabs . length )
6589
- ) {
6587
+ // Actually add this window to our defaultState
6590
6588
defaultState . windows . push ( newWindowState ) ;
6591
6589
// Remove the window from the state if it doesn't have any tabs
6592
6590
if ( ! window . tabs . length ) {
0 commit comments