From 6075d0503672122dfb761259b0dcacafe90c5770 Mon Sep 17 00:00:00 2001 From: "isherman@chromium.org" Date: Tue, 13 Sep 2011 02:10:21 +0000 Subject: Fix crash that occurs when users with Password Autofill data try to log in to websites. BUG=96321 TEST=none Review URL: http://codereview.chromium.org/7879002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100840 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/autofill/autofill_agent.cc | 3 +++ chrome/renderer/autofill/password_autofill_manager.cc | 7 +++++++ chrome/renderer/autofill/password_autofill_manager.h | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc index d18d9b4..2c95945 100644 --- a/chrome/renderer/autofill/autofill_agent.cc +++ b/chrome/renderer/autofill/autofill_agent.cc @@ -170,6 +170,9 @@ void AutofillAgent::didSelectAutofillSuggestion(const WebNode& node, } void AutofillAgent::didClearAutofillSelection(const WebNode& node) { + if (password_autofill_manager_->DidClearAutofillSelection(node)) + return; + DCHECK(node == autofill_query_element_); FormManager::ClearPreviewedFormWithElement(autofill_query_element_, was_query_node_autofilled_); diff --git a/chrome/renderer/autofill/password_autofill_manager.cc b/chrome/renderer/autofill/password_autofill_manager.cc index d2954cc..10c74bd 100644 --- a/chrome/renderer/autofill/password_autofill_manager.cc +++ b/chrome/renderer/autofill/password_autofill_manager.cc @@ -322,6 +322,13 @@ bool PasswordAutofillManager::DidSelectAutofillSuggestion( return FindLoginInfo(node, &input, &password); } +bool PasswordAutofillManager::DidClearAutofillSelection( + const WebKit::WebNode& node) { + WebKit::WebInputElement input; + PasswordInfo password; + return FindLoginInfo(node, &input, &password); +} + void PasswordAutofillManager::SendPasswordForms(WebKit::WebFrame* frame, bool only_visible) { // Make sure that this security origin is allowed to use password manager. diff --git a/chrome/renderer/autofill/password_autofill_manager.h b/chrome/renderer/autofill/password_autofill_manager.h index eb671e1..34bae2d 100644 --- a/chrome/renderer/autofill/password_autofill_manager.h +++ b/chrome/renderer/autofill/password_autofill_manager.h @@ -45,6 +45,10 @@ class PasswordAutofillManager : public RenderViewObserver, // A no-op. No filling happens for selection. But this method returns // true when |node| is fillable by password Autofill. bool DidSelectAutofillSuggestion(const WebKit::WebNode& node); + // A no-op. Password forms are not previewed, so they do not need to be + // cleared when the selection changes. However, this method returns + // true when |node| is fillable by password Autofill. + bool DidClearAutofillSelection(const WebKit::WebNode& node); private: friend class PasswordAutofillManagerTest; -- cgit v1.1