diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 17:22:43 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 17:22:43 +0000 |
commit | feb7cfba67c122cd39ae15e3bac5a2be5a2014e5 (patch) | |
tree | 9d050d10fa86b8251fe42424b565c833f2443708 /webkit | |
parent | a01805c89445c44c954668c8441fa5d2f416fff5 (diff) | |
download | chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.zip chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.tar.gz chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.tar.bz2 |
This CL ensures we don't store empty values in the autofill form DB.
Also it applies a clean-up to remove any empty values previously stored in the DB.
BUG=6111
TEST=Submit a form and leave some fields empty. Come back to that form, click on a field that was empty. No autofill popup should show up (or if one show up, it should not contains empty values).
Review URL: http://codereview.chromium.org/21217
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/autofill_form.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/webkit/glue/autofill_form.cc b/webkit/glue/autofill_form.cc index 9ad9237..ee38b05 100644 --- a/webkit/glue/autofill_form.cc +++ b/webkit/glue/autofill_form.cc @@ -15,6 +15,7 @@ MSVC_POP_WARNING(); #include "base/basictypes.h" #include "base/logging.h" +#include "base/string_util.h" #include "webkit/glue/autofill_form.h" #include "webkit/glue/glue_util.h" @@ -57,9 +58,18 @@ AutofillForm* AutofillForm::CreateAutofillForm( continue; // For each TEXT input field, store the name and value - std::wstring name = webkit_glue::StringToStdWString(input_element->name()); std::wstring value = webkit_glue::StringToStdWString( input_element->value()); + TrimWhitespace(value, TRIM_LEADING, &value); + if (value.length() == 0) + continue; + + std::wstring name = webkit_glue::StringToStdWString(input_element->name()); + // Test that the name is not blank. + std::wstring trimmed_name; + TrimWhitespace(name, TRIM_LEADING, &trimmed_name); + if (trimmed_name.length() == 0) + continue; result->elements.push_back(AutofillForm::Element(name, value)); } |