summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 06:24:41 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 06:24:41 +0000
commit5fed0f1c5195ded63dfadadeb93c0b1d006f1fb4 (patch)
treee930888c90bcb4eb7de4084f463835e23da6d36e /chrome
parentc07c97572a7d4b5f2eba6402cc5f173408d6c8c5 (diff)
downloadchromium_src-5fed0f1c5195ded63dfadadeb93c0b1d006f1fb4.zip
chromium_src-5fed0f1c5195ded63dfadadeb93c0b1d006f1fb4.tar.gz
chromium_src-5fed0f1c5195ded63dfadadeb93c0b1d006f1fb4.tar.bz2
AutoFill form filling with form name absent
A provisional fix for situations where AutoFill is filling a form that has no set name attribute. In this case we now match the first form found on the page with no name set. BUG=37990 TEST=Manual steps as described in bug using sample8.html as test file. Review URL: http://codereview.chromium.org/863007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41405 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/form_manager.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/chrome/renderer/form_manager.cc b/chrome/renderer/form_manager.cc
index 31e65d1..cbb78b9 100644
--- a/chrome/renderer/form_manager.cc
+++ b/chrome/renderer/form_manager.cc
@@ -114,7 +114,15 @@ bool FormManager::FillForm(const FormData& form) {
// Form loop.
for (std::vector<FormElement*>::iterator form_iter = iter->second.begin();
form_iter != iter->second.end(); ++form_iter) {
- if ((*form_iter)->form_element.name() == form.name) {
+ // 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.
+ // 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 &&
+ (*form_iter)->input_elements.size() == form.elements.size()) {
form_element = *form_iter;
break;
}