diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-01-25 05:05:50 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-01-25 05:05:50 +0800 |
commit | 0518fff76056458a5d6d3c246ed459b0f2e8ed04 (patch) | |
tree | f994fe45c830f9d3f8058bee1301511774746006 /embed | |
parent | 932522948a6660aa1ac0517f208bd8bb22147451 (diff) | |
download | gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar.gz gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar.bz2 gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar.lz gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar.xz gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.tar.zst gsoc2013-epiphany-0518fff76056458a5d6d3c246ed459b0f2e8ed04.zip |
When checking forms for modifications, handle correctly text entries with
2004-01-24 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyBrowser.cpp:
When checking forms for modifications, handle correctly
text entries with default value longer than maxlength.
Mozilla bug #232057.
Diffstat (limited to 'embed')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 5f8657309..cd6d18f7c 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -900,7 +900,7 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi /* Mozilla Bug 218277, 195946 and others */ default_text.ReplaceChar(0xa0, ' '); - if (Compare (user_text, default_text) != 0) + if (!user_text.Equals (default_text)) { *aHasTextArea = PR_TRUE; return NS_OK; @@ -918,13 +918,25 @@ nsresult EphyBrowser::GetDocumentHasModifiedForms (nsIDOMDocument *aDomDoc, PRUi if (type.EqualsIgnoreCase("text")) { nsAutoString default_text, user_text; + PRInt32 max_length; inputElement->GetDefaultValue (default_text); inputElement->GetValue (user_text); + inputElement->GetMaxLength (&max_length); + + /* Guard against arguably broken forms where + * default_text is longer than maxlength + * (user_text is cropped, default_text is not) + * Mozilla bug 232057 + */ + if (default_text.Length() > (PRUint32)max_length) + { + default_text.Truncate (max_length); + } /* Mozilla Bug 218277, 195946 and others */ default_text.ReplaceChar(0xa0, ' '); - if (Compare (user_text, default_text) != 0) + if (!user_text.Equals (default_text)) { (*aNumTextFields)++; if (*aNumTextFields >= NUM_MODIFIED_TEXTFIELDS_REQUIRED) |