Commit ccc930f5 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Set a non-null profile in TMSPS even if IncognitoTabModel returns null.

|IncognitoTabModelImpl#getProfile| returns null, and that makes
|TabModelSelectorProfileSupplier| provides null profile to the callers.
Null profile causes crashes on |IdentityDiscController| that uses
TMSPS to observe profile changes. This CL sets a non-null profile in
TMSPS, even if IncognitoTabModelImpl returns null profile.

Bug: 1124597, 1124653
Change-Id: I48c248865294cf5415333e9653d2f7773a9910b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391154Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarPatrick Noland <pnoland@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806438}
parent 75efc8f5
......@@ -57,7 +57,15 @@ public class TabModelSelectorProfileSupplier
@Override
public void onTabStateInitialized() {
set(mSelector.getCurrentModel().getProfile());
Profile profile = mSelector.getCurrentModel().getProfile();
if (profile == null) {
// Since only IncognitoTabModelImpl provides null profile, the current model should be
// off-the-record.
assert mSelector.getCurrentModel().isIncognito();
// TODO(https://crbug.com/1060940): Update to cover all OTR profiles.
profile = Profile.getLastUsedRegularProfile().getPrimaryOTRProfile();
}
set(profile);
}
public void destroy() {
......
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