Changeset 252768 in webkit


Ignore:
Timestamp:
Nov 22, 2019 5:09:29 AM (4 years ago)
Author:
Carlos Garcia Campos
Message:

File input should fire an 'input' event before the 'change' event
https://bugs.webkit.org/show_bug.cgi?id=204292

Reviewed by Wenson Hsieh.

Source/WebCore:

"Queue a task to first update the element's selected files so that it represents the user's selection, then fire
an event named input at the input element, with the bubbles attribute initialized to true, and finally fire an
event named change at the input element, with the bubbles attribute initialized to true."
https://html.spec.whatwg.org/#file-upload-state-(type=file):event-input

This will also fix WebDriver test imported/w3c/webdriver/tests/element_send_keys/events.py::test_file_upload in
safari driver.

Test: fast/forms/file/file-input-user-selection-events.html

  • html/FileInputType.cpp:

(WebCore::FileInputType::setFiles):

LayoutTests:

Add new test to check both events are fired now.

  • fast/forms/file/file-input-user-selection-events-expected.txt: Added.
  • fast/forms/file/file-input-user-selection-events.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252762 r252768  
     12019-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        File input should fire an 'input' event before the 'change' event
     4        https://bugs.webkit.org/show_bug.cgi?id=204292
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Add new test to check both events are fired now.
     9
     10        * fast/forms/file/file-input-user-selection-events-expected.txt: Added.
     11        * fast/forms/file/file-input-user-selection-events.html: Added.
     12
    1132019-11-21  Jer Noble  <jer.noble@apple.com>
    214
  • trunk/LayoutTests/platform/win/TestExpectations

    r252760 r252768  
    36723672fast/dom/FileList-iterator-using-open-panel.html [ Skip ]
    36733673fast/forms/file/file-input-reset-using-open-panel.html [ Skip ]
     3674fast/forms/file/file-input-user-selection-events.html [ Skip ]
    36743675fast/forms/file/file-reset-in-change-using-open-panel.html [ Skip ]
    36753676fast/forms/file/file-reset-in-change-using-open-panel-with-icon.html [ Skip ]
  • trunk/LayoutTests/platform/wincairo/TestExpectations

    r252760 r252768  
    762762fast/files/filereader-zip-bundle-using-open-panel.html [ Timeout ]
    763763fast/forms/file/file-input-reset-using-open-panel.html [ Timeout ]
     764fast/forms/file/file-input-user-selection-events.html [ Timeout ]
    764765fast/forms/file/entries-api/webkitdirectory-open-panel.html [ Timeout ]
    765766fast/forms/file/file-reset-in-change-using-open-panel.html [ Timeout ]
  • trunk/Source/WebCore/ChangeLog

    r252762 r252768  
     12019-11-22  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        File input should fire an 'input' event before the 'change' event
     4        https://bugs.webkit.org/show_bug.cgi?id=204292
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        "Queue a task to first update the element's selected files so that it represents the user's selection, then fire
     9        an event named input at the input element, with the bubbles attribute initialized to true, and finally fire an
     10        event named change at the input element, with the bubbles attribute initialized to true."
     11        https://html.spec.whatwg.org/#file-upload-state-(type=file):event-input
     12
     13        This will also fix WebDriver test imported/w3c/webdriver/tests/element_send_keys/events.py::test_file_upload in
     14        safari driver.
     15
     16        Test: fast/forms/file/file-input-user-selection-events.html
     17
     18        * html/FileInputType.cpp:
     19        (WebCore::FileInputType::setFiles):
     20
    1212019-11-21  Jer Noble  <jer.noble@apple.com>
    222
  • trunk/Source/WebCore/html/FileInputType.cpp

    r250061 r252768  
    400400        // This call may cause destruction of this instance.
    401401        // input instance is safe since it is ref-counted.
     402        protectedInputElement->dispatchInputEvent();
    402403        protectedInputElement->dispatchChangeEvent();
    403404    }
Note: See TracChangeset for help on using the changeset viewer.