Changeset 279979 in webkit


Ignore:
Timestamp:
Jul 15, 2021 11:52:15 PM (12 months ago)
Author:
Chris Dumez
Message:

Implement 'SubmitEvent' interface
https://bugs.webkit.org/show_bug.cgi?id=202978

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that more checks are passing.

  • web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt:
  • web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt:

Source/WebCore:

Implement 'SubmitEvent' interface as per:

Both Chrome and Firefox already ship this.

No new tests, rebaselined existing tests.

  • CMakeLists.txt:
  • DerivedSources-input.xcfilelist:
  • DerivedSources-output.xcfilelist:
  • DerivedSources.make:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/EventNames.in:
  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::submitIfPossible):

  • html/SubmitEvent.cpp: Added.

(WebCore::SubmitEvent::create):
(WebCore::SubmitEvent::SubmitEvent):
(WebCore::SubmitEvent::eventInterface const):

  • html/SubmitEvent.h: Added.

(WebCore::SubmitEvent::submitter const):

  • html/SubmitEvent.idl: Added.
  • html/SubmitInputType.cpp:

(WebCore::SubmitInputType::handleDOMActivateEvent):
Make sure SubmitInputType::handleDOMActivateEvent() passes its element as submitter
when submitting the form. One of the subtests in html/semantics/forms/form-submission-0/implicit-submission.optional.html
covers this.

LayoutTests:

Rebaseline WPT test now that more checks are passing.

  • platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
  • platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
Location:
trunk
Files:
3 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r279978 r279979  
     12021-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement 'SubmitEvent' interface
     4        https://bugs.webkit.org/show_bug.cgi?id=202978
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline WPT test now that more checks are passing.
     9
     10        * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     11        * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
     12
    1132021-07-15  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r279971 r279979  
     12021-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement 'SubmitEvent' interface
     4        https://bugs.webkit.org/show_bug.cgi?id=202978
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline WPT tests now that more checks are passing.
     9
     10        * web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt:
     11        * web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt:
     12
    1132021-07-15  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/SubmitEvent.window-expected.txt

    r263987 r279979  
    11
    2 FAIL Failing SubmitEvent constructor assert_throws_js: 0 arguments function "() => { new SubmitEvent() }" threw object "ReferenceError: Can't find variable: SubmitEvent" ("ReferenceError") expected instance of function "function TypeError() {
    3     [native code]
    4 }" ("TypeError")
    5 FAIL Successful SubmitEvent constructor Can't find variable: SubmitEvent
    6 FAIL Successful SubmitEvent constructor; null/undefined submitter Can't find variable: SubmitEvent
    7 FAIL Successful SubmitEvent constructor; null/undefined dictionary Can't find variable: SubmitEvent
    8 FAIL Successful SubmitEvent constructor; empty dictionary Can't find variable: SubmitEvent
    9 FAIL Successful SubmitEvent constructor; missing dictionary Can't find variable: SubmitEvent
     2PASS Failing SubmitEvent constructor
     3PASS Successful SubmitEvent constructor
     4PASS Successful SubmitEvent constructor; null/undefined submitter
     5PASS Successful SubmitEvent constructor; null/undefined dictionary
     6PASS Successful SubmitEvent constructor; empty dictionary
     7PASS Successful SubmitEvent constructor; missing dictionary
    108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/implicit-submission.optional-expected.txt

    r279427 r279979  
    33
    44
    5 FAIL Submit event with a submit button assert_equals: expected (object) Element node <input name="submitButton" type="submit"></input> but got (undefined) undefined
    6 FAIL Submit event with no submit button assert_equals: expected (object) null but got (undefined) undefined
     5PASS Submit event with a submit button
     6PASS Submit event with no submit button
    77
  • trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279978 r279979  
    37673767PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
    37683768PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
    3769 FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3770 FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3771 FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3772 FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3773 FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3774 FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3775 FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
     3769PASS SubmitEvent interface: existence and properties of interface object
     3770PASS SubmitEvent interface object length
     3771PASS SubmitEvent interface object name
     3772PASS SubmitEvent interface: existence and properties of interface prototype object
     3773PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
     3774PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
     3775PASS SubmitEvent interface: attribute submitter
    37763776FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
    37773777FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
  • trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279978 r279979  
    37773777PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
    37783778PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
    3779 FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3780 FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3781 FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3782 FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3783 FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3784 FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3785 FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
     3779PASS SubmitEvent interface: existence and properties of interface object
     3780PASS SubmitEvent interface object length
     3781PASS SubmitEvent interface object name
     3782PASS SubmitEvent interface: existence and properties of interface prototype object
     3783PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
     3784PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
     3785PASS SubmitEvent interface: attribute submitter
    37863786FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
    37873787FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
  • trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt

    r279978 r279979  
    37773777PASS ValidityState interface: document.createElement("input").validity must inherit property "customError" with the proper type
    37783778PASS ValidityState interface: document.createElement("input").validity must inherit property "valid" with the proper type
    3779 FAIL SubmitEvent interface: existence and properties of interface object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3780 FAIL SubmitEvent interface object length assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3781 FAIL SubmitEvent interface object name assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3782 FAIL SubmitEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3783 FAIL SubmitEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3784 FAIL SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
    3785 FAIL SubmitEvent interface: attribute submitter assert_own_property: self does not have own property "SubmitEvent" expected property "SubmitEvent" missing
     3779PASS SubmitEvent interface: existence and properties of interface object
     3780PASS SubmitEvent interface object length
     3781PASS SubmitEvent interface object name
     3782PASS SubmitEvent interface: existence and properties of interface prototype object
     3783PASS SubmitEvent interface: existence and properties of interface prototype object's "constructor" property
     3784PASS SubmitEvent interface: existence and properties of interface prototype object's @@unscopables property
     3785PASS SubmitEvent interface: attribute submitter
    37863786FAIL FormDataEvent interface: existence and properties of interface object assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
    37873787FAIL FormDataEvent interface object length assert_own_property: self does not have own property "FormDataEvent" expected property "FormDataEvent" missing
  • trunk/Source/WebCore/CMakeLists.txt

    r279971 r279979  
    10261026    html/OffscreenCanvas.idl
    10271027    html/RadioNodeList.idl
     1028    html/SubmitEvent.idl
    10281029    html/TextMetrics.idl
    10291030    html/TimeRanges.idl
  • trunk/Source/WebCore/ChangeLog

    r279978 r279979  
     12021-07-15  Chris Dumez  <cdumez@apple.com>
     2
     3        Implement 'SubmitEvent' interface
     4        https://bugs.webkit.org/show_bug.cgi?id=202978
     5
     6        Reviewed by Alex Christensen.
     7
     8        Implement 'SubmitEvent' interface as per:
     9        - https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent
     10
     11        Both Chrome and Firefox already ship this.
     12
     13        No new tests, rebaselined existing tests.
     14
     15        * CMakeLists.txt:
     16        * DerivedSources-input.xcfilelist:
     17        * DerivedSources-output.xcfilelist:
     18        * DerivedSources.make:
     19        * Sources.txt:
     20        * WebCore.xcodeproj/project.pbxproj:
     21        * dom/EventNames.in:
     22        * html/HTMLFormElement.cpp:
     23        (WebCore::HTMLFormElement::submitIfPossible):
     24        * html/SubmitEvent.cpp: Added.
     25        (WebCore::SubmitEvent::create):
     26        (WebCore::SubmitEvent::SubmitEvent):
     27        (WebCore::SubmitEvent::eventInterface const):
     28        * html/SubmitEvent.h: Added.
     29        (WebCore::SubmitEvent::submitter const):
     30        * html/SubmitEvent.idl: Added.
     31
     32        * html/SubmitInputType.cpp:
     33        (WebCore::SubmitInputType::handleDOMActivateEvent):
     34        Make sure SubmitInputType::handleDOMActivateEvent() passes its element as submitter
     35        when submitting the form. One of the subtests in html/semantics/forms/form-submission-0/implicit-submission.optional.html
     36        covers this.
     37
    1382021-07-15  Chris Dumez  <cdumez@apple.com>
    239
  • trunk/Source/WebCore/DerivedSources-input.xcfilelist

    r279971 r279979  
    10521052$(PROJECT_DIR)/html/OffscreenCanvas.idl
    10531053$(PROJECT_DIR)/html/RadioNodeList.idl
     1054$(PROJECT_DIR)/html/SubmitEvent.idl
    10541055$(PROJECT_DIR)/html/TextMetrics.idl
    10551056$(PROJECT_DIR)/html/TimeRanges.idl
  • trunk/Source/WebCore/DerivedSources-output.xcfilelist

    r279971 r279979  
    22462246$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheetList.cpp
    22472247$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleSheetList.h
     2248$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubmitEvent.cpp
     2249$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubmitEvent.h
    22482250$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubtleCrypto.cpp
    22492251$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSSubtleCrypto.h
  • trunk/Source/WebCore/DerivedSources.make

    r279971 r279979  
    902902    $(WebCore)/html/OffscreenCanvas.idl \
    903903    $(WebCore)/html/RadioNodeList.idl \
     904    $(WebCore)/html/SubmitEvent.idl \
    904905    $(WebCore)/html/TextMetrics.idl \
    905906    $(WebCore)/html/TimeRanges.idl \
  • trunk/Source/WebCore/Sources.txt

    r279971 r279979  
    12991299html/SearchInputType.cpp
    13001300html/StepRange.cpp
     1301html/SubmitEvent.cpp
    13011302html/SubmitInputType.cpp
    13021303html/TelephoneInputType.cpp
     
    36743675JSStyleSheet.cpp
    36753676JSStyleSheetList.cpp
     3677JSSubmitEvent.cpp
    36763678JSSubtleCrypto.cpp
    36773679JSText.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r279971 r279979  
    13181318                46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13191319                46CA9C441F97BBE9004CFC3A /* VisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CA9C411F97BBE7004CFC3A /* VisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1320                46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */; };
    13201321                46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
    13211322                46DD93D7269DE756001AFD88 /* BroadcastChannelIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    83998400                46CA9C411F97BBE7004CFC3A /* VisibilityState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibilityState.h; sourceTree = "<group>"; };
    84008401                46CA9C421F97BBE7004CFC3A /* VisibilityState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VisibilityState.idl; sourceTree = "<group>"; };
     8402                46D0003C26A0FE6F00D1BF1E /* SubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubmitEvent.cpp; sourceTree = "<group>"; };
     8403                46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubmitEvent.h; sourceTree = "<group>"; };
     8404                46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubmitEvent.idl; sourceTree = "<group>"; };
    84018405                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
    84028406                46DD93D5269DE74B001AFD88 /* BroadcastChannelIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BroadcastChannelIdentifier.h; sourceTree = "<group>"; };
     
    2417124175                                A5AFB34D115151A700B045CB /* StepRange.cpp */,
    2417224176                                A5AFB34E115151A700B045CB /* StepRange.h */,
     24177                                46D0003C26A0FE6F00D1BF1E /* SubmitEvent.cpp */,
     24178                                46D0003E26A0FE6F00D1BF1E /* SubmitEvent.h */,
     24179                                46D0003F26A0FE7000D1BF1E /* SubmitEvent.idl */,
    2417324180                                F55B3D9F1251F12D003EF269 /* SubmitInputType.cpp */,
    2417424181                                F55B3DA01251F12D003EF269 /* SubmitInputType.h */,
     
    3551035517                                D000ED2811C1B9CD00C47726 /* SubframeLoader.h in Headers */,
    3551135518                                1FC40FBA1655CCB90040F29E /* SubimageCacheWithTimer.h in Headers */,
     35519                                46D0004026A0FEB300D1BF1E /* SubmitEvent.h in Headers */,
    3551235520                                F55B3DD41251F12D003EF269 /* SubmitInputType.h in Headers */,
    3551335521                                656D37480ADBA5DE00A4554D /* SubresourceLoader.h in Headers */,
  • trunk/Source/WebCore/dom/EventNames.in

    r278630 r279979  
    3636ProgressEvent
    3737PromiseRejectionEvent
     38SubmitEvent
    3839TextEvent
    3940TransitionEvent
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r279401 r279979  
    5656#include "ScriptDisallowedScope.h"
    5757#include "Settings.h"
     58#include "SubmitEvent.h"
    5859#include "UserGestureIndicator.h"
    5960#include <limits>
     
    269270
    270271    bool shouldValidate = document().page() && document().page()->settings().interactiveFormValidationEnabled() && !noValidate();
    271 
    272272    if (shouldValidate) {
    273273        auto submitElement = makeRefPtr(submitter ? submitter : findSubmitter(event));
     
    290290    auto protectedThis = makeRef(*this);
    291291
    292     auto submitEvent = Event::create(eventNames().submitEvent, Event::CanBubble::Yes, Event::IsCancelable::Yes);
     292    auto submitEvent = SubmitEvent::create(submitter);
    293293    dispatchEvent(submitEvent);
    294294
  • trunk/Source/WebCore/html/SubmitInputType.cpp

    r277257 r279979  
    7676    protectedElement->setActivatedSubmit(true);
    7777    if (auto currentForm = makeRefPtr(protectedElement->form()))
    78         currentForm->submitIfPossible(&event); // Event handlers can run.
     78        currentForm->submitIfPossible(&event, element()); // Event handlers can run.
    7979    protectedElement->setActivatedSubmit(false);
    8080    event.setDefaultHandled();
Note: See TracChangeset for help on using the changeset viewer.