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

Unified Diff: chrome/renderer/autofill/form_autofill_util.cc

Issue 9225042: Fix Autofill hang when interacting with large forms (i.e. forms containing many fields). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test failure -- don't count hidden fields Created 8 years, 11 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/renderer/autofill/form_autofill_util.h ('k') | chrome/renderer/autofill/form_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/form_autofill_util.cc
diff --git a/chrome/renderer/autofill/form_autofill_util.cc b/chrome/renderer/autofill/form_autofill_util.cc
index 95684fd9827844d38cc4dd7206d74c9eb918ceb1..105c89dec33683700874f1617ebe65f87acd9fd7 100644
--- a/chrome/renderer/autofill/form_autofill_util.cc
+++ b/chrome/renderer/autofill/form_autofill_util.cc
@@ -535,6 +535,8 @@ void PreviewFormField(WebKit::WebFormControlElement* field,
namespace autofill {
+const size_t kMaxParseableFields = 100;
+
// In HTML5, all text fields except password are text input fields to
// autocomplete.
bool IsTextInput(const WebInputElement* element) {
@@ -717,8 +719,9 @@ bool WebFormElementToFormData(
fields_extracted[i] = true;
}
- // If we failed to extract any fields, give up.
- if (form_fields.empty())
+ // If we failed to extract any fields, give up. Also, to avoid overly
+ // expensive computation, we impose a maximum number of allowable fields.
+ if (form_fields.empty() || form_fields.size() > kMaxParseableFields)
return false;
// Loop through the label elements inside the form element. For each label
« no previous file with comments | « chrome/renderer/autofill/form_autofill_util.h ('k') | chrome/renderer/autofill/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698