Bug 60948

Summary: tooLong validity should not be true for a value set by a script
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Major CC: commit-queue, dglazkov, morrita
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2011/005296.html
Attachments:
Description Flags
Patch none

Description Kent Tamura 2011-05-17 01:14:19 PDT
The specification was updated a few days ago. See the URL.
Comment 1 Kent Tamura 2011-05-17 01:31:23 PDT
Created attachment 93747 [details]
Patch
Comment 2 Hajime Morrita 2011-05-17 03:24:10 PDT
Comment on attachment 93747 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=93747&action=review

> Source/WebCore/html/HTMLInputElement.cpp:935
> +            m_wasModifiedByUser = sendChangeEvent;

Are there any possibility to overwrite? existing "true" value?
For example, Is it possible to make this false by script after some user action that made this true.

> Source/WebCore/html/HTMLTextAreaElement.h:113
> +    bool m_wasModifiedByUser;

should be mutable? or updateValue() should not be const?
const_cast<> inside updateValue() apparently indicates something wrong.
Comment 3 Kent Tamura 2011-05-17 03:39:51 PDT
Comment on attachment 93747 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=93747&action=review

>> Source/WebCore/html/HTMLInputElement.cpp:935
>> +            m_wasModifiedByUser = sendChangeEvent;
> 
> Are there any possibility to overwrite? existing "true" value?
> For example, Is it possible to make this false by script after some user action that made this true.

Yes, it's possible and it's an expected behavior. 

If the <input> has user-edited value (m_wasModifedByUser=true) and a script calls setValue("foobar"), m_wasModifedByUser should be cleared.

>> Source/WebCore/html/HTMLTextAreaElement.h:113
>> +    bool m_wasModifiedByUser;
> 
> should be mutable? or updateValue() should not be const?
> const_cast<> inside updateValue() apparently indicates something wrong.

We should remove 'const' from updateValue().
Comment 4 Hajime Morrita 2011-05-17 04:17:55 PDT
(In reply to comment #3)
> (From update of attachment 93747 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93747&action=review
> 
> >> Source/WebCore/html/HTMLInputElement.cpp:935
> >> +            m_wasModifiedByUser = sendChangeEvent;
> > 
> > Are there any possibility to overwrite? existing "true" value?
> > For example, Is it possible to make this false by script after some user action that made this true.
> 
> Yes, it's possible and it's an expected behavior. 
I see. The expectation is different from what I thought. But it's reasonable.
Comment 5 Kent Tamura 2011-05-18 21:38:44 PDT
Comment on attachment 93747 [details]
Patch

Thank you for r+!
Comment 6 WebKit Commit Bot 2011-05-19 02:48:51 PDT
The commit-queue encountered the following flaky tests while processing attachment 93747 [details]:

java/lc3/JavaObject/JavaObjectToByte-006.html bug 60333 (author: ap@webkit.org)
The commit-queue is continuing to process your patch.
Comment 7 WebKit Commit Bot 2011-05-19 02:50:20 PDT
Comment on attachment 93747 [details]
Patch

Clearing flags on attachment: 93747

Committed r86832: <http://trac.webkit.org/changeset/86832>
Comment 8 WebKit Commit Bot 2011-05-19 02:50:26 PDT
All reviewed patches have been landed.  Closing bug.