From fbf90315b8420502dbad77b9741f7547b3f2187e Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Thu, 22 Apr 2010 22:41:17 +0000 Subject: AutoFill: Also use the form action to uniquely identify which form to fill in FormManager::FillForm. BUG=42271 TEST=FormManagerTest.FillFormEmptyFormNames Review URL: http://codereview.chromium.org/1736011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45367 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/form_manager.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'chrome/renderer/form_manager.cc') diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc index c66cd74..19ae004 100644 --- a/chrome/renderer/form_manager.cc +++ b/chrome/renderer/form_manager.cc @@ -366,16 +366,20 @@ bool FormManager::FillForm(const FormData& form) { for (WebFrameFormElementMap::iterator iter = form_elements_map_.begin(); iter != form_elements_map_.end(); ++iter) { + const WebFrame* frame = iter->first; + for (std::vector::iterator form_iter = iter->second.begin(); form_iter != iter->second.end(); ++form_iter) { // TODO(dhollowa): matching on form name here which is not guaranteed to // be unique for the page, nor is it guaranteed to be non-empty. Need to - // find a way to uniquely identify the form cross-process. + // find a way to uniquely identify the form cross-process. For now we'll + // check form name and form action for identity. // http://crbug.com/37990 test file sample8.html. // Also note that WebString() == WebString(string16()) does not seem to // evaluate to |true| for some reason TBD, so forcing to string16. string16 element_name((*form_iter)->form_element.name()); - if (element_name == form.name) { + GURL action(frame->completeURL((*form_iter)->form_element.action())); + if (element_name == form.name && action == form.action) { form_element = *form_iter; break; } -- cgit v1.1