0

[Sessions] Remove Group and Window entries when the last tab is restored

Pass the SessionId of the window or group to remove when they become
empty after a restore.

This prevents a bug where the recent tabs menu could show entries with
0 restorable tabs. See bug for screenshot.

Change-Id: I44c4364121d14061079df06cebd86db450531eaf
Bug: 405426765
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6382275
Reviewed-by: Eshwar Stalin <estalin@chromium.org>
Commit-Queue: Darryl James <dljames@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1436327}
This commit is contained in:
dljames
2025-03-21 15:31:14 -07:00
committed by Chromium LUCI CQ
parent 386f251c2c
commit e9c9bd287a
2 changed files with 69 additions and 2 deletions
chrome/browser/sessions
components/sessions/core

@ -695,7 +695,7 @@ std::vector<LiveTab*> TabRestoreServiceHelper::RestoreEntryById(
// The entries_ may by changed after the tabs restored and the
// entry_iterator may be no longer valid. So call RemoveEntryById here
// instead of entries_.erase(entry_iterator).
RemoveEntryById(id);
RemoveEntryById(window.id);
}
}
@ -751,7 +751,7 @@ std::vector<LiveTab*> TabRestoreServiceHelper::RestoreEntryById(
// The entries_ may by changed after the tabs restored and the
// entry_iterator may be no longer valid. So call RemoveEntryById
// here instead of entries_.erase(entry_iterator).
RemoveEntryById(id);
RemoveEntryById(group.id);
}
break;