New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 798079 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

When I use autocomplete, the html element "textarea" with the attribute "maxLength" can insert text that is biger then a value of maxLength.

Reported by dmitry.s...@gmail.com, Dec 29 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

Steps to reproduce the problem:
1. I have got a form with <input> and <textarea>
2. I type the name in the <input>
3. Browser suggests me autocomplete
4. When I selected the name from the gropdown, textarea was autocompleted too
5. Value of textarea was bigger maxLength

What is the expected behavior?
Value of textarea has to be equal maxLength

What went wrong?
Value of textarea eas not equal maxLength

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 63.0.3239.84  Channel: n/a
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
 
fdd9c04f538c9dfdc161b586820dd569.png
16.6 KB View Download
Labels: Needs-Triage-M63
Thanks for filing the issue

@Reporter:
Can you please provide the sample test file/URL to test this issue which helps us to triage it in a better way from TE end. 

Thanks!
Cc: viswatej...@techmahindra.com sc00335...@techmahindra.com
Labels: Triaged-ET Needs-Feedback

Comment 4 by tkent@chromium.org, Jan 9 2018

Components: -Blink>HTML UI>Browser>Autofill

Comment 5 by se...@chromium.org, Jan 9 2018

Owner: se...@chromium.org
Status: Assigned (was: Unconfirmed)

Comment 6 by se...@chromium.org, Jan 19 2018

Cc: tkent@chromium.org keishi@chromium.org
tkent@ & keishi@

I looked at the code and I can't seem to find a place in particular from SetValue where it would resize the value. It seems to do it by itself.

Do you know where that happens? I could maybe do the same thing for textarea.

Otherwise, I think I'd add a SetAutofillValue in both HTMLInputElement and HTMLTextAreaElement and I'd do the trimming there.

What do you think?

Comment 7 by tkent@chromium.org, Jan 22 2018

In general maxlength restricts only user-input, and doesn't restrict value IDL setter.  HTMLTextAreaElement::HandleBeforeTextInsertedEvent() doesn't work for Blink's setValue() functions.

On autofilling <input>, maxlength is handled at https://cs.chromium.org/chromium/src/components/autofill/content/renderer/autofill_agent.cc?type=cs&sq=package:chromium&l=672 .

Moving such maxlength handling to somewhere inside of WebFormControlElement::SetAutofillValue() sounds reasonable.

Project Member

Comment 8 by bugdroid1@chromium.org, Jan 24 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/778c4369e0f70c9902b2cd7e43c63d2baf935b08

commit 778c4369e0f70c9902b2cd7e43c63d2baf935b08
Author: sebsg <sebsg@chromium.org>
Date: Wed Jan 24 20:01:32 2018

[Autofill] Truncate autofill suggestions and fills to maxlength.

Bug:  798079 
Change-Id: I45d5bdf444d8d8d1605593afa83dfe25d68d3bb0
Reviewed-on: https://chromium-review.googlesource.com/862259
Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531657}
[modify] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/components/autofill/content/renderer/autofill_agent.cc
[add] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/LayoutTests/fast/forms/autofill-respects-maxlength.html
[add] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/LayoutTests/fast/forms/text/input-appearance-autocomplete-suggestion-maxlength-expected.html
[add] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/LayoutTests/fast/forms/text/input-appearance-autocomplete-suggestion-maxlength.html
[add] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/LayoutTests/fast/forms/text/textarea-appearance-autocomplete-suggestion-maxlength-expected.html
[add] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/LayoutTests/fast/forms/text/textarea-appearance-autocomplete-suggestion-maxlength.html
[modify] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/Source/core/exported/WebFormControlElement.cpp
[modify] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/Source/core/html/forms/TextControlElement.cpp
[modify] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/Source/core/html/forms/TextControlElement.h
[modify] https://crrev.com/778c4369e0f70c9902b2cd7e43c63d2baf935b08/third_party/WebKit/Source/core/testing/Internals.cpp

Comment 9 by se...@chromium.org, Jan 24 2018

Status: Fixed (was: Assigned)

Sign in to add a comment