Changeset 188672 in webkit


Ignore:
Timestamp:
Aug 19, 2015 5:55:10 PM (9 years ago)
Author:
Wenson Hsieh
Message:

Select validation does not correctly work when handling change event
https://bugs.webkit.org/show_bug.cgi?id=145869

Reviewed by Dean Jackson.

Source/WebCore:

When selecting an option in a <select> with validation that also has an onchange listener, calling
checkValidity() for the select within the onchange handler would produce incorrect results and (on
a debug build) crash at an assertion. This is because the change events were being dispatched before
form validity was updated. Making the validation step come before the change event dispatch fixes
this issue.

Test: fast/forms/onchange-select-check-validity.html

  • html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::selectOption): Update validity before dispatching change events.

LayoutTests:

Tests that checkValidity() returns correct results from within the onchange handler of a
<select> when the validity of the selected option changes.

  • fast/forms/onchange-select-check-validity-expected.txt: Added.
  • fast/forms/onchange-select-check-validity.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r188666 r188672  
     12015-08-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Select validation does not correctly work when handling change event
     4        https://bugs.webkit.org/show_bug.cgi?id=145869
     5
     6        Reviewed by Dean Jackson.
     7
     8        Tests that checkValidity() returns correct results from within the onchange handler of a
     9        <select> when the validity of the selected option changes.
     10
     11        * fast/forms/onchange-select-check-validity-expected.txt: Added.
     12        * fast/forms/onchange-select-check-validity.html: Added.
     13
    1142015-08-19  Jinyoung Hur  <hur.ims@navercorp.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r188666 r188672  
     12015-08-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Select validation does not correctly work when handling change event
     4        https://bugs.webkit.org/show_bug.cgi?id=145869
     5
     6        Reviewed by Dean Jackson.
     7
     8        When selecting an option in a <select> with validation that also has an onchange listener, calling
     9        checkValidity() for the select within the onchange handler would produce incorrect results and (on
     10        a debug build) crash at an assertion. This is because the change events were being dispatched before
     11        form validity was updated. Making the validation step come before the change event dispatch fixes
     12        this issue.
     13
     14        Test: fast/forms/onchange-select-check-validity.html
     15
     16        * html/HTMLSelectElement.cpp:
     17        (WebCore::HTMLSelectElement::selectOption): Update validity before dispatching change events.
     18
    1192015-08-19  Jinyoung Hur  <hur.ims@navercorp.com>
    220
  • trunk/Source/WebCore/html/HTMLSelectElement.cpp

    r188520 r188672  
    902902    scrollToSelection();
    903903
     904    updateValidity();
    904905    if (usesMenuList()) {
    905906        m_isProcessingUserDrivenChange = flags & UserDriven;
     
    913914        }
    914915    }
    915 
    916     updateValidity();
    917916}
    918917
Note: See TracChangeset for help on using the changeset viewer.