Commit 330c6e9e authored by Mohammad Refaat's avatar Mohammad Refaat Committed by Commit Bot

Fix savesession to work when there are no active webState

Sessions should be saved when there are no webStates at all, right now
Chrome doesn't save the session if there is no active webState which
include cases where there are no webStates at all.

Bug: 989482
Change-Id: I96538dbf21be6d20730dd8800988379f0882c8d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730166
Auto-Submit: Mohammad Refaat <mrefaat@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683739}
parent 13343039
......@@ -511,7 +511,8 @@ void RecordMainFrameNavigationMetric(web::WebState* web_state) {
- (void)saveSessionImmediately:(BOOL)immediately {
// Do nothing if there are tabs in the model but no selected tab. This is
// a transitional state.
if (!_webStateList->GetActiveWebState() || !_browserState)
if ((!_webStateList->GetActiveWebState() && _webStateList->count()) ||
!_browserState)
return;
NSString* statePath =
base::SysUTF8ToNSString(_browserState->GetStatePath().AsUTF8Unsafe());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment