Commit cd678f56 authored by Monica Basta's avatar Monica Basta Committed by Commit Bot

[Signin]: Fix for crash in UserManagerProfileDialog::DisplayErrorMessage

The code assumes if no browser exists for the profile where the signin
is happening then the sign in error is related to the user manager. The
previous assumption is not valid if the user decides to close the
profile while the user manager or another profile is open.  This CL
compares the profile path with |UserManager::GetSigninProfilePath| and
only in case of equality uses
|UserManagerProfileDialog::DisplayErrorMessage| to show the sign in
error.

Bug: 1132175
Change-Id: Icccdc44d3927d8750bea9957120d7fef6677c4aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2435309
Commit-Queue: David Roger <droger@chromium.org>
Auto-Submit: Monica Basta <msalama@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814147}
parent 40b18187
...@@ -266,6 +266,9 @@ void UserManager::AddOnUserManagerShownCallbackForTesting( ...@@ -266,6 +266,9 @@ void UserManager::AddOnUserManagerShownCallbackForTesting(
// static // static
base::FilePath UserManager::GetSigninProfilePath() { base::FilePath UserManager::GetSigninProfilePath() {
if (!g_user_manager_view)
return base::FilePath();
return g_user_manager_view->GetSigninProfilePath(); return g_user_manager_view->GetSigninProfilePath();
} }
......
...@@ -103,10 +103,13 @@ void LoginUIService::DisplayLoginResult(Browser* browser, ...@@ -103,10 +103,13 @@ void LoginUIService::DisplayLoginResult(Browser* browser,
last_login_result_ = error_message; last_login_result_ = error_message;
last_login_error_email_ = email; last_login_error_email_ = email;
if (!error_message.empty()) { if (!error_message.empty()) {
if (browser) if (browser) {
browser->signin_view_controller()->ShowModalSigninErrorDialog(); browser->signin_view_controller()->ShowModalSigninErrorDialog();
else } else if (profile_->GetPath() == UserManager::GetSigninProfilePath()) {
UserManagerProfileDialog::DisplayErrorMessage(); UserManagerProfileDialog::DisplayErrorMessage();
} else {
LOG(ERROR) << "Unable to show Login error message: " << error_message;
}
} else if (browser) { } else if (browser) {
browser->window()->ShowAvatarBubbleFromAvatarButton( browser->window()->ShowAvatarBubbleFromAvatarButton(
BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN, BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN,
......
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