Commit 8aac555f authored by Vasilii Sukhanov's avatar Vasilii Sukhanov Committed by Commit Bot

Fix a crash when the password bubble closes.

When a tab is closed from the renderer via window.close(), the password bubble may still be show. When it closes PasswordFormManager may decided to upload some votes. ChromePasswordManagerClient still exists at this point but ContentAutofillDriverFactory can already be deleted. The code should check this condition.

Bug: 807601
Change-Id: If75c1aa5759e07568340d2233b22cc159e8c687e
Reviewed-on: https://chromium-review.googlesource.com/911770Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Commit-Queue: Vasilii Sukhanov <vasilii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535894}
parent 4cb14ba3
......@@ -616,10 +616,14 @@ autofill::AutofillManager*
ChromePasswordManagerClient::GetAutofillManagerForMainFrame() {
autofill::ContentAutofillDriverFactory* factory =
autofill::ContentAutofillDriverFactory::FromWebContents(web_contents());
return factory
? factory->DriverForFrame(web_contents()->GetMainFrame())
->autofill_manager()
: nullptr;
if (factory) {
autofill::ContentAutofillDriver* driver =
factory->DriverForFrame(web_contents()->GetMainFrame());
// |driver| can be NULL if the tab is being closed.
if (driver)
return driver->autofill_manager();
}
return nullptr;
}
void ChromePasswordManagerClient::SetTestObserver(
......
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