Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: webkit/glue/autofill_form.cc

Issue 21217: Don't store empty values for autofill (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/webdata/web_database_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/autofill_form.cc
===================================================================
--- webkit/glue/autofill_form.cc (revision 9373)
+++ webkit/glue/autofill_form.cc (working copy)
@@ -15,6 +15,7 @@
#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,10 +58,19 @@
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));
}
« no previous file with comments | « chrome/browser/webdata/web_database_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698