When the last session of a browser is loaded it does not take the traditional route of adding an entry into the TabRestoreService. Instead of going through the helper classes (TabRestoreServiceHelper, TabRestoerServiceImpl) which provide all of the setup for the tab_restore::Window object, loading the last sessions immediately adds the entry to the TabRestoreService.
This means that any fields that require pre-processing will be empty. To fix this, we add an additional check when a WINDOW entry is added to populate its tab_groups field. This ultimately prevents a CHECK crash that will happen when a user clicks on the 3-dot (app menu) button.
Change-Id: Ia27673d6f5a82cdbff6cbb84977daf84075ad8bf
Bug: 338555375
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5515918
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Darryl James <dljames@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1296295}