Commit 9ad779c6 authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Check passwordManager in PasswordController JS completion

It is possible for the PasswordController to be detached between
the call to GetPageURLAndCheckTrustLevel and the JS completion.
In that case, passwordManager is reset and there is a nullptr
exception.

Bug: 791710
Change-Id: Ibec514aefbaf5fb7a8773cd0254f0bf2f785e06e
Reviewed-on: https://chromium-review.googlesource.com/808045Reviewed-by: default avatarVaclav Brozek <vabr@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521672}
parent 34367313
......@@ -478,7 +478,8 @@ bool GetPageURLAndCheckTrustLevel(web::WebState* web_state, GURL* page_url) {
// TODO(crbug.com/418827): Fix this by passing in more data from the JS side.
id completionHandler = ^(BOOL found, const autofill::PasswordForm& form) {
PasswordController* strongSelf = weakSelf;
if (strongSelf && ![strongSelf isWebStateDestroyed]) {
if (strongSelf && ![strongSelf isWebStateDestroyed] &&
strongSelf.passwordManager) {
strongSelf.passwordManager->OnPasswordFormSubmitted(
strongSelf.passwordManagerDriver, form);
}
......
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