<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>59975</bug_id>
          
          <creation_ts>2011-05-02 16:26:48 -0700</creation_ts>
          <short_desc>ValidityState::valid causes value sanitization 7 times</short_desc>
          <delta_ts>2024-06-29 16:04:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joseph Pecoraro">joepeck</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>akeerthi</cc>
    
    <cc>ashvayka</cc>
    
    <cc>dmikurube</cc>
    
    <cc>joepeck</cc>
    
    <cc>rniwa</cc>
    
    <cc>tkent</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>396769</commentid>
    <comment_count>0</comment_count>
    <who name="Joseph Pecoraro">joepeck</who>
    <bug_when>2011-05-02 16:26:48 -0700</bug_when>
    <thetext>I noticed this while working on value sanitization for date inputs.
This could be a performance issue, because sanitization requires
parsing the input to see if it is valid.

    bool ValidityState::valid() const
    {
        bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
            || tooLong() || patternMismatch() || valueMissing() || customError();
        return !someError;
    }

It seems like this could really benefit from caching, or a better
design that allows for getting the sanitized value once, and running
the different validity tests on the pre-calculated value.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960233</commentid>
    <comment_count>1</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-06-07 01:57:11 -0700</bug_when>
    <thetext>We still have similar function but different name:

https://searchfox.org/wubkat/source/Source/WebCore/html/FormListedElement.cpp#244


bool FormListedElement::computeValidity() const
{
    bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
        || tooShort() || tooLong() || patternMismatch() || valueMissing() || hasBadInput() || customError();
    return !someError;
}

https://searchfox.org/wubkat/source/Source/WebCore/html/HTMLInputElement.cpp#344

bool HTMLInputElement::computeValidity() const
{
    String value = this-&gt;value();
    bool someError = m_inputType-&gt;isInvalid(value) || tooShort(value, CheckDirtyFlag) || tooLong(value, CheckDirtyFlag) || customError();
    return !someError;
}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2043806</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-06-29 16:04:42 -0700</bug_when>
    <thetext>&lt;rdar://problem/130825308&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>