Changeset 193957 in webkit


Ignore:
Timestamp:
Dec 11, 2015 9:35:52 AM (8 years ago)
Author:
Darin Adler
Message:

Reduce the number of events that can be created by Document.createEvent
https://bugs.webkit.org/show_bug.cgi?id=151931

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

  • web-platform-tests/dom/events/ProgressEvent-expected.txt: Updated for progression.
  • web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt:

Ditto.

Source/WebCore:

Document.createEvent is intended for use only with a certain set of legacy events.
Ideally it should only be the ones mentioned in the DOM specification.

For now, at least remove all the events that can't usefully be created and initialized
this way. Later, we should cut it down even smaller. And stop automatically generating
this, which was causing everyone who made an event IDL file to get supported here!

The modern alternative is to use event class constructors instead.

  • CMakeLists.txt: Don't compile EventFactory.cpp. For now, we still generate

EventFactory.cpp but we do not use it.

  • DerivedSources.make: Ditto.
  • WebCore.vcxproj/WebCore.vcxproj: Ditto.
  • WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto. Also don't include EventFactory.h in the

project file.

  • dom/DOMImplementation.cpp:

(WebCore::DOMImplementation::hasFeature): Added a comment about the SVGZoomEvents feature.

  • dom/Document.cpp: Re-sorted includes and added the new ones needed for createEvent.

(WebCore::Document::createEvent): Moved all the logic here from EventFactory, and
took a crack at comments that explain what this should and should not be used for.

  • dom/EventFactory.h: Removed.

LayoutTests:

on createEvent("IDBVersionChangeEvent").

  • animations/animation-events-create.html: Updated to use

"new WebKitAnimationEvent" instead of document.createEvent.

  • fast/events/event-creation-expected.txt: Removed expected results for

various events that can no longer be created with createEvent.

  • fast/events/event-creation.html: Removed tests for various events

that can no longer be created with createEvent.

  • imported/blink/plugins/plugin-synthetic-event-crash.html: Updated to use

"new PopStateEvent" instead of document.createEvent.

  • indieui/create-uirequestevent-expected.txt: Removed.
  • indieui/create-uirequestevent.html: Removed.
  • platform/mac-wk2/TestExpecations: Removed expectations for some deleted tests.
  • platform/wk2/storage/indexeddb/removed-expected.txt: Removed, since this is

no different from the platform-independent expected result.

  • transitions/transition-end-event-create.html: Updated to use

"new WebKitTransitionEvent" instead of document.createEvent.

Location:
trunk
Files:
4 deleted
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r193956 r193957  
     12015-12-11  Darin Adler  <darin@apple.com>
     2
     3        Reduce the number of events that can be created by Document.createEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=151931
     5
     6        Reviewed by Alex Christensen.
     7
     8        * TestExpectations: Added expected failures for the two tests that depend
     9        on createEvent("IDBVersionChangeEvent").
     10
     11        * animations/animation-events-create.html: Updated to use
     12        "new WebKitAnimationEvent" instead of document.createEvent.
     13
     14        * fast/events/event-creation-expected.txt: Removed expected results for
     15        various events that can no longer be created with createEvent.
     16        * fast/events/event-creation.html: Removed tests for various events
     17        that can no longer be created with createEvent.
     18
     19        * imported/blink/plugins/plugin-synthetic-event-crash.html: Updated to use
     20        "new PopStateEvent" instead of document.createEvent.
     21
     22        * indieui/create-uirequestevent-expected.txt: Removed.
     23        * indieui/create-uirequestevent.html: Removed.
     24
     25        * platform/mac-wk2/TestExpecations: Removed expectations for some deleted tests.
     26
     27        * platform/wk2/storage/indexeddb/removed-expected.txt: Removed, since this is
     28        no different from the platform-independent expected result.
     29
     30        * transitions/transition-end-event-create.html: Updated to use
     31        "new WebKitTransitionEvent" instead of document.createEvent.
     32
    1332015-12-11  Nikita Vasilyev  <nvasilyev@apple.com>
    234
  • trunk/LayoutTests/TestExpectations

    r193924 r193957  
    650650webkit.org/b/144258 [ Debug ] js/class-syntax-semicolon.html [ Skip ]
    651651
     652# IDBVersionChangeEvent tests need to be rewritten to use event constructors instead of createEvent,
     653# after we implement the IDBVersionChangeEvent constructor.
     654webkit.org/b/145390 storage/indexeddb/events.html [ Failure ]
     655webkit.org/b/145390 storage/indexeddb/removed.html [ Failure ]
     656
    652657webkit.org/b/145390 storage/indexeddb/deleteIndex-bug110792.html [ Pass Failure ]
    653658
  • trunk/LayoutTests/animations/animation-events-create.html

    r155274 r193957  
    1818debug("Test creation of WebKitAnimationEvent");
    1919
    20 var ev = document.createEvent("WebKitAnimationEvent");
     20var ev = new WebKitAnimationEvent("");
    2121
    2222shouldBe("typeof(ev)", "'object'");
  • trunk/LayoutTests/fast/events/event-creation-expected.txt

    r176423 r193957  
    1010PASS document.createEvent('HTMLEvents') instanceof window.Event is true
    1111PASS document.createEvent('HTMLEvents').constructor === window.Event is true
    12 PASS document.createEvent('AnimationEvent') instanceof window.AnimationEvent is true
    13 PASS document.createEvent('AnimationEvent') instanceof window.Event is true
    14 PASS document.createEvent('AnimationEvent').constructor === window.AnimationEvent is true
    15 PASS document.createEvent('BeforeLoadEvent') instanceof window.BeforeLoadEvent is true
    16 PASS document.createEvent('BeforeLoadEvent') instanceof window.Event is true
    17 PASS document.createEvent('BeforeLoadEvent').constructor === window.BeforeLoadEvent is true
    1812PASS document.createEvent('CompositionEvent') instanceof window.CompositionEvent is true
    1913PASS document.createEvent('CompositionEvent') instanceof window.Event is true
     
    2216PASS document.createEvent('CustomEvent') instanceof window.Event is true
    2317PASS document.createEvent('CustomEvent').constructor === window.CustomEvent is true
    24 PASS document.createEvent('ErrorEvent') instanceof window.ErrorEvent is true
    25 PASS document.createEvent('ErrorEvent') instanceof window.Event is true
    26 PASS document.createEvent('ErrorEvent').constructor === window.ErrorEvent is true
    2718PASS document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent is true
    2819PASS document.createEvent('HashChangeEvent') instanceof window.Event is true
     
    5647PASS document.createEvent('OverflowEvent') instanceof window.Event is true
    5748PASS document.createEvent('OverflowEvent').constructor === window.OverflowEvent is true
    58 PASS document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent is true
    59 PASS document.createEvent('PageTransitionEvent') instanceof window.Event is true
    60 PASS document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent is true
    61 PASS document.createEvent('PopStateEvent') instanceof window.PopStateEvent is true
    62 PASS document.createEvent('PopStateEvent') instanceof window.Event is true
    63 PASS document.createEvent('PopStateEvent').constructor === window.PopStateEvent is true
    64 PASS document.createEvent('ProgressEvent') instanceof window.ProgressEvent is true
    65 PASS document.createEvent('ProgressEvent') instanceof window.Event is true
    66 PASS document.createEvent('ProgressEvent').constructor === window.ProgressEvent is true
    6749PASS document.createEvent('TextEvent') instanceof window.TextEvent is true
    6850PASS document.createEvent('TextEvent') instanceof window.UIEvent is true
     
    7557PASS document.createEvent('UIEvents') instanceof window.Event is true
    7658PASS document.createEvent('UIEvents').constructor === window.UIEvent is true
    77 PASS document.createEvent('TransitionEvent') instanceof window.TransitionEvent is true
    78 PASS document.createEvent('TransitionEvent') instanceof window.Event is true
    79 PASS document.createEvent('TransitionEvent').constructor === window.TransitionEvent is true
    80 PASS document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent is true
    81 PASS document.createEvent('WebKitAnimationEvent') instanceof window.Event is true
    82 PASS document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent is true
    83 PASS document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent is true
    84 PASS document.createEvent('WebKitTransitionEvent') instanceof window.Event is true
    85 PASS document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent is true
    8659PASS document.createEvent('WheelEvent') instanceof window.WheelEvent is true
    8760PASS document.createEvent('WheelEvent') instanceof window.MouseEvent is true
     
    8962PASS document.createEvent('WheelEvent') instanceof window.Event is true
    9063PASS document.createEvent('WheelEvent').constructor === window.WheelEvent is true
    91 PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent is true
    92 PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent is true
    93 PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event is true
    94 PASS document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent is true
    9564PASS document.createEvent('StorageEvent') instanceof window.StorageEvent is true
    9665PASS document.createEvent('StorageEvent') instanceof window.Event is true
    9766PASS document.createEvent('StorageEvent').constructor === window.StorageEvent is true
    98 PASS document.createEvent('SVGEvents') instanceof window.Event is true
    99 PASS document.createEvent('SVGEvents').constructor === window.Event is true
    100 PASS document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent is true
    101 PASS document.createEvent('SVGZoomEvent') instanceof window.Event is true
    102 PASS document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent is true
    10367PASS document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent is true
    10468PASS document.createEvent('SVGZoomEvents') instanceof window.Event is true
    10569PASS document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent is true
    106 PASS document.createEvent('CloseEvent') instanceof window.CloseEvent is true
    107 PASS document.createEvent('CloseEvent') instanceof window.Event is true
    108 PASS document.createEvent('CloseEvent').constructor === window.CloseEvent is true
    10970PASS allEventInterfacesCreateEvents is true
    11071PASS successfullyParsed is true
  • trunk/LayoutTests/fast/events/event-creation.html

    r176423 r193957  
    1818    shouldBeTrue("document.createEvent('HTMLEvents').constructor === window.Event");
    1919
    20     // AnimationEvent
    21     shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.AnimationEvent");
    22     shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event");
    23     shouldBeTrue("document.createEvent('AnimationEvent').constructor === window.AnimationEvent");
    24 
    25     // BeforeLoadEvent
    26     shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.BeforeLoadEvent");
    27     shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.Event");
    28     shouldBeTrue("document.createEvent('BeforeLoadEvent').constructor === window.BeforeLoadEvent");
    29 
    3020    // CompositionEvent
    3121    shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.CompositionEvent");
     
    3727    shouldBeTrue("document.createEvent('CustomEvent') instanceof window.Event");
    3828    shouldBeTrue("document.createEvent('CustomEvent').constructor === window.CustomEvent");
    39 
    40     // ErrorEvent
    41     shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.ErrorEvent");
    42     shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event");
    43     shouldBeTrue("document.createEvent('ErrorEvent').constructor === window.ErrorEvent");
    4429
    4530    // HashChangeEvent
     
    9277    shouldBeTrue("document.createEvent('OverflowEvent').constructor === window.OverflowEvent");
    9378
    94     // PageTransitionEvent
    95     shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent");
    96     shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.Event");
    97     shouldBeTrue("document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent");
    98 
    99     // PopStateEvent
    100     shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.PopStateEvent");
    101     shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.Event");
    102     shouldBeTrue("document.createEvent('PopStateEvent').constructor === window.PopStateEvent");
    103 
    104     // ProgressEvent
    105     shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.ProgressEvent");
    106     shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.Event");
    107     shouldBeTrue("document.createEvent('ProgressEvent').constructor === window.ProgressEvent");
    108 
    10979    // TextEvent
    11080    shouldBeTrue("document.createEvent('TextEvent') instanceof window.TextEvent");
     
    12393    shouldBeTrue("document.createEvent('UIEvents').constructor === window.UIEvent");
    12494
    125     // TransitionEvent
    126     shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.TransitionEvent");
    127     shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.Event");
    128     shouldBeTrue("document.createEvent('TransitionEvent').constructor === window.TransitionEvent");
    129 
    130     // WebKitAnimationEvent
    131     shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent");
    132     shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.Event");
    133     shouldBeTrue("document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent");
    134 
    135     // WebKitTransitionEvent
    136     shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent");
    137     shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.Event");
    138     shouldBeTrue("document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent");
    139 
    14095    // WheelEvent
    14196    shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
     
    145100    shouldBeTrue("document.createEvent('WheelEvent').constructor === window.WheelEvent");
    146101
    147     // XMLHttpRequestProgressEvent
    148     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent");
    149     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent");
    150     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event");
    151     shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent");
    152 
    153102    // StorageEvent
    154103    shouldBeTrue("document.createEvent('StorageEvent') instanceof window.StorageEvent");
     
    156105    shouldBeTrue("document.createEvent('StorageEvent').constructor === window.StorageEvent");
    157106
    158     // #if ENABLE(SVG)
    159     // SVGEvents (Event alternative)
    160     shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event");
    161     shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event");
    162 
    163     // #if ENABLE(SVG)
    164     // SVGZoomEvent
    165     shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent");
    166     shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.Event");
    167     shouldBeTrue("document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent");
    168 
    169     // #if ENABLE(SVG)
    170     // SVGZoomEvents (SVGZoomEvent alternative)
     107    // SVGZoomEvents
    171108    shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent");
    172109    shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.Event");
    173110    shouldBeTrue("document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent");
    174111
    175     // #if ENABLE(WEB_SOCKETS)
    176     // CloseEvent
    177     shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEvent");
    178     shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event");
    179     shouldBeTrue("document.createEvent('CloseEvent').constructor === window.CloseEvent");
    180 
    181     // The following are here for completeness, but won't until there is more widespread support for them.
    182 
    183     // #if ENABLE(WEB_AUDIO)
    184     // AudioProcessingEvent
    185     // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.AudioProcessingEvent");
    186     // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.Event");
    187     // shouldBeTrue("document.createEvent('AudioProcessingEvent').constructor === window.AudioProcessingEvent");
    188 
    189     // #if ENABLE(WEB_AUDIO)
    190     // OfflineAudioCompletionEvent
    191     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.OfflineAudioCompletionEvent");
    192     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.Event");
    193     // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent').constructor === window.OfflineAudioCompletionEvent");
    194 
    195     // #if ENABLE(INPUT_SPEECH)
    196     // MediaStreamEvent
    197     // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.MediaStreamEvent");
    198     // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.Event");
    199     // shouldBeTrue("document.createEvent('MediaStreamEvent').constructor === window.MediaStreamEvent");
    200 
    201     // #if ENABLE(INPUT_SPEECH)
    202     // SpeechInputEvent
    203     // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.SpeechInputEvent");
    204     // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.Event");
    205     // shouldBeTrue("document.createEvent('SpeechInputEvent').constructor === window.SpeechInputEvent");
    206 
    207     // #if ENABLE(WEBGL)
    208     // WebGLContextEvent
    209     // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.WebGLContextEvent");
    210     // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.Event");
    211     // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === window.WebGLContextEvent");
     112    // The following are here for completeness, but we won't run these tests until they are supported in more ports.
    212113
    213114    // #if ENABLE(TOUCH_EVENTS)
     
    228129    // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.Event");
    229130    // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor === window.DeviceOrientationEvent");
    230 
    231     // #if ENABLE(ORIENTATION_EVENTS)
    232     // OrientationEvent (Event alternative)
    233     // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.Event");
    234     // shouldBeTrue("document.createEvent('OrientationEvent').constructor === window.Event");
    235 
    236     // #if ENABLE(REQUEST_AUTOCOMPLETE)
    237     // AutocompleteErrorEvent
    238     // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.AutocompleteErrorEvent");
    239     // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.Event");
    240     // shouldBeTrue("document.createEvent('AutocompleteErrorEvent').constructor === window.AutocompleteErrorEvent");
    241131
    242132    // We test both a hard coded set and the automated set below (using enumeration) to ensure that a constructor being removed
     
    279169    shouldBeTrue('allEventInterfacesCreateEvents');
    280170</script>
    281 
    282 
    283 
    284171<script src="../../resources/js-test-post.js"></script>
    285172</body>
  • trunk/LayoutTests/imported/blink/plugins/plugin-synthetic-event-crash.html

    r190629 r193957  
    2525});
    2626
    27 var event = document.createEvent("PopStateEvent");
    28 event.initEvent("touchmove", true, true);
    29 plugin.dispatchEvent(event);
    30 
    31 event = document.createEvent("PopStateEvent");
    32 event.initEvent("gesturescrollstart", true, true);
    33 plugin.dispatchEvent(event);
    34 
    35 event = document.createEvent("PopStateEvent");
    36 event.initEvent("mousewheel", true, true);
    37 plugin.dispatchEvent(event);
     27plugin.dispatchEvent(new PopStateEvent("touchmove", { bubbles: true, cancelable: true }));
     28plugin.dispatchEvent(new PopStateEvent("gesturescrollstart", { bubbles: true, cancelable: true }));
     29plugin.dispatchEvent(new PopStateEvent("mousewheel", { bubbles: true, cancelable: true }));
    3830</script>
    3931</body>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r193840 r193957  
     12015-12-11  Darin Adler  <darin@apple.com>
     2
     3        Reduce the number of events that can be created by Document.createEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=151931
     5
     6        Reviewed by Alex Christensen.
     7
     8        * web-platform-tests/dom/events/ProgressEvent-expected.txt: Updated for progression.
     9        * web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt:
     10        Ditto.
     11
    1122015-12-09  Keith Rollin  <krollin@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/ProgressEvent-expected.txt

    r189471 r193957  
    11
    22FAIL Default event values. assert_equals: expected (boolean) false but got (undefined) undefined
    3 FAIL document.createEvent() should not work with ProgressEvent. assert_throws: function "function () {
    4     document.createEvent("ProgressEvent")
    5   }" did not throw
     3PASS document.createEvent() should not work with ProgressEvent.
    64
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt

    r189476 r193957  
    11
    2 FAIL TrackEvent created with createEvent assert_throws: function "function () {
    3         var ev = document.createEvent('Trac..." did not throw
     2PASS TrackEvent created with createEvent
    43
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r193838 r193957  
    388388storage/indexeddb/cursor-basics.html [ Skip ]
    389389storage/indexeddb/cursor-continue-validity.html [ Skip ]
    390 storage/indexeddb/cursor-continueprimarykey.html [ Skip ]
    391390storage/indexeddb/cursor-index-delete.html [ Skip ]
    392391storage/indexeddb/cursor-key-order.html [ Skip ]
     
    396395storage/indexeddb/cursor-request-cycle.html [ Skip ] # Missing needed WKTR feature?
    397396storage/indexeddb/cursor-update.html [ Skip ]
    398 storage/indexeddb/data-corruption.html [ Skip ]
    399397storage/indexeddb/database-close.html [ Skip ]
    400398storage/indexeddb/database-quota.html [ Skip ]
    401399storage/indexeddb/duplicates.html [ Skip ] # Difference between null + undefined
    402400storage/indexeddb/events.html [ Skip ]
    403 storage/indexeddb/factory-basics.html [ Skip ] # indexedDB.webkitGetDatabaseNames is missing)
    404401storage/indexeddb/factory-cmp.html [ Skip ]
    405402storage/indexeddb/get-keyrange.html [ Skip ]
  • trunk/LayoutTests/transitions/transition-end-event-create.html

    r155285 r193957  
    1818debug("Test creation of WebKitTransitionEvent");
    1919
    20 var ev = document.createEvent("WebKitTransitionEvent");
     20var ev = new WebKitTransitionEvent("");
    2121
    2222shouldBe("typeof(ev)", "'object'");
  • trunk/Source/WebCore/CMakeLists.txt

    r193944 r193957  
    36433643
    36443644
    3645 GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventNames.in EventFactory.cpp)
    3646 list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventFactory.cpp)
     3645GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventNames.in EventInterfaces.h)
     3646list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventInterfaces.h)
    36473647
    36483648
  • trunk/Source/WebCore/ChangeLog

    r193949 r193957  
     12015-12-11  Darin Adler  <darin@apple.com>
     2
     3        Reduce the number of events that can be created by Document.createEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=151931
     5
     6        Reviewed by Alex Christensen.
     7
     8        Document.createEvent is intended for use only with a certain set of legacy events.
     9        Ideally it should only be the ones mentioned in the DOM specification.
     10
     11        For now, at least remove all the events that can't usefully be created and initialized
     12        this way. Later, we should cut it down even smaller. And stop automatically generating
     13        this, which was causing everyone who made an event IDL file to get supported here!
     14
     15        The modern alternative is to use event class constructors instead.
     16
     17        * CMakeLists.txt: Don't compile EventFactory.cpp. For now, we still generate
     18        EventFactory.cpp but we do not use it.
     19        * DerivedSources.make: Ditto.
     20        * WebCore.vcxproj/WebCore.vcxproj: Ditto.
     21        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
     22        * WebCore.xcodeproj/project.pbxproj: Ditto. Also don't include EventFactory.h in the
     23        project file.
     24
     25        * dom/DOMImplementation.cpp:
     26        (WebCore::DOMImplementation::hasFeature): Added a comment about the SVGZoomEvents feature.
     27
     28        * dom/Document.cpp: Re-sorted includes and added the new ones needed for createEvent.
     29        (WebCore::Document::createEvent): Moved all the logic here from EventFactory, and
     30        took a crack at comments that explain what this should and should not be used for.
     31
     32        * dom/EventFactory.h: Removed.
     33
    1342015-12-10  Brady Eidson  <beidson@apple.com>
    235
  • trunk/Source/WebCore/DerivedSources.make

    r193389 r193957  
    800800    CSSValueKeywords.h \
    801801    ColorData.cpp \
    802     EventFactory.cpp \
     802    EventInterfaces.h \
    803803    EventTargetInterfaces.h \
    804804    ExceptionCodeDescription.cpp \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r193426 r193957  
    878878      <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Production|x64'">4819;%(DisableSpecificWarnings)</DisableSpecificWarnings>
    879879    </ClCompile>
    880     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\EventFactory.cpp" />
    881880    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionCodeDescription.cpp" />
    882881    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLElementFactory.cpp">
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r193426 r193957  
    50205020      <Filter>DerivedSources</Filter>
    50215021    </ClCompile>
    5022     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\EventFactory.cpp">
    5023       <Filter>DerivedSources</Filter>
    5024     </ClCompile>
    50255022    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionCodeDescription.cpp">
    50265023      <Filter>DerivedSources</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r193944 r193957  
    37733773                97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37743774                97627B9814FB5424002CDCA1 /* Supplementable.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B9714FB5424002CDCA1 /* Supplementable.h */; settings = {ATTRIBUTES = (Private, ); }; };
    3775                 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; };
    3776                 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; };
    37773775                9767CE0B145ABC13005E64DB /* ExceptionHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE09145ABC12005E64DB /* ExceptionHeaders.h */; };
    37783776                9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */; };
     
    1127011268                97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextDestructionObserver.h; sourceTree = "<group>"; };
    1127111269                97627B9714FB5424002CDCA1 /* Supplementable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Supplementable.h; sourceTree = "<group>"; };
    11272                 97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; };
    11273                 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; };
    1127411270                9767CE09145ABC12005E64DB /* ExceptionHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHeaders.h; sourceTree = "<group>"; };
    1127511271                9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionInterfaces.h; sourceTree = "<group>"; };
     
    1728017276                                9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */,
    1728117277                                E1C6CFC21746D293007B87A1 /* DOMWindowConstructors.idl */,
    17282                                 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */,
    1728317278                                970B72A5145008EB00F00A37 /* EventHeaders.h */,
    1728417279                                970B7289144FFAC600F00A37 /* EventInterfaces.h */,
     
    2386023855                                BC60D9090D2A17CE00B9918F /* EventException.h */,
    2386123856                                BC60D90A0D2A17CE00B9918F /* EventException.idl */,
    23862                                 97665011144FAA4200F6BB51 /* EventFactory.h */,
    2386323857                                935FBC4409BA00B900E230B1 /* EventListener.h */,
    2386423858                                85AFA7410AAF298400E84305 /* EventListener.idl */,
     
    2545225446                                418A06D0133C04D500CD379C /* EventDispatcher.h in Headers */,
    2545325447                                BC60D90C0D2A17CE00B9918F /* EventException.h in Headers */,
    25454                                 97665013144FAA4200F6BB51 /* EventFactory.h in Headers */,
    2545525448                                93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
    2545625449                                970B72A6145008EB00F00A37 /* EventHeaders.h in Headers */,
     
    2911229105                                4138D3361244054800323D33 /* EventContext.cpp in Sources */,
    2911329106                                418A06D1133C04D500CD379C /* EventDispatcher.cpp in Sources */,
    29114                                 9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */,
    2911529107                                93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */,
    2911629108                                FE6938B61045D67E008EABB6 /* EventHandlerIOS.mm in Sources */,
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r189576 r193957  
    193193    }
    194194
     195    // FIXME: SVG specifications <http://www.w3.org/TR/SVG/script.html#InterfaceSVGZoomEvent>
     196    // and <http://www.w3.org/TR/SVG2/interact.html#InterfaceSVGZoomEvent>
     197    // say that we should return true for the feature "SVGZoomEvents".
     198
    195199    return true;
    196200}
  • trunk/Source/WebCore/dom/Document.cpp

    r193885 r193957  
    4242#include "ChromeClient.h"
    4343#include "Comment.h"
     44#include "CompositionEvent.h"
    4445#include "ContentSecurityPolicy.h"
    4546#include "CookieJar.h"
     47#include "CustomEvent.h"
    4648#include "DOMImplementation.h"
    4749#include "DOMNamedFlowCollection.h"
     
    5759#include "ElementIterator.h"
    5860#include "EntityReference.h"
    59 #include "EventFactory.h"
    6061#include "EventHandler.h"
    6162#include "ExtensionStyleSheets.h"
     
    99100#include "JSLazyEventListener.h"
    100101#include "JSModuleLoader.h"
     102#include "KeyboardEvent.h"
    101103#include "Language.h"
    102104#include "LoaderStrategy.h"
     
    107109#include "MediaQueryList.h"
    108110#include "MediaQueryMatcher.h"
     111#include "MessageEvent.h"
    109112#include "MouseEventWithHitTestResults.h"
     113#include "MutationEvent.h"
    110114#include "NameNodeList.h"
    111115#include "NestingLevelIncrementer.h"
     
    113117#include "NodeRareData.h"
    114118#include "NodeWithIndex.h"
     119#include "OverflowEvent.h"
    115120#include "PageConsoleClient.h"
    116121#include "PageGroup.h"
     
    134139#include "SVGNames.h"
    135140#include "SVGTitleElement.h"
     141#include "SVGZoomEvent.h"
    136142#include "SchemeRegistry.h"
    137143#include "ScopedEventQueue.h"
     
    147153#include "Settings.h"
    148154#include "ShadowRoot.h"
     155#include "StorageEvent.h"
    149156#include "StyleProperties.h"
    150157#include "StyleResolver.h"
     
    152159#include "StyleSheetList.h"
    153160#include "SubresourceLoader.h"
     161#include "TextEvent.h"
    154162#include "TextNodeTraversal.h"
    155163#include "TransformSource.h"
    156164#include "TreeWalker.h"
    157165#include "VisitedLinkState.h"
     166#include "WheelEvent.h"
    158167#include "XMLDocumentParser.h"
    159168#include "XMLNSNames.h"
     
    172181#include <yarr/RegularExpression.h>
    173182
    174 #if ENABLE(XSLT)
    175 #include "XSLTProcessor.h"
    176 #endif
    177 
    178 
    179 #if ENABLE(TOUCH_EVENTS)
    180 #include "TouchList.h"
     183#if ENABLE(CSP_NEXT)
     184#include "DOMSecurityPolicy.h"
     185#endif
     186
     187#if ENABLE(DEVICE_ORIENTATION)
     188#include "DeviceMotionEvent.h"
     189#include "DeviceOrientationEvent.h"
     190#endif
     191
     192#if ENABLE(FULLSCREEN_API)
     193#include "RenderFullScreen.h"
    181194#endif
    182195
     
    198211#endif
    199212
     213#if ENABLE(IOS_TEXT_AUTOSIZING)
     214#include "TextAutoSizing.h"
     215#endif
     216
    200217#if ENABLE(MATHML)
    201218#include "MathMLElement.h"
     
    204221#endif
    205222
    206 #if ENABLE(FULLSCREEN_API)
    207 #include "RenderFullScreen.h"
     223#if ENABLE(MEDIA_SESSION)
     224#include "MediaSession.h"
    208225#endif
    209226
     
    213230#endif
    214231
    215 #if ENABLE(IOS_TEXT_AUTOSIZING)
    216 #include "TextAutoSizing.h"
    217 #endif
    218 
    219232#if ENABLE(TEXT_AUTOSIZING)
    220233#include "TextAutosizer.h"
    221234#endif
    222235
    223 #if ENABLE(CSP_NEXT)
    224 #include "DOMSecurityPolicy.h"
     236#if ENABLE(TOUCH_EVENTS)
     237#include "TouchEvent.h"
     238#include "TouchList.h"
    225239#endif
    226240
     
    239253#endif
    240254
    241 #if ENABLE(MEDIA_SESSION)
    242 #include "MediaSession.h"
     255#if ENABLE(XSLT)
     256#include "XSLTProcessor.h"
    243257#endif
    244258
     
    41084122}
    41094123
    4110 RefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
    4111 {
    4112     RefPtr<Event> event = EventFactory::create(eventType);
    4113     if (event)
    4114         return event.release();
     4124RefPtr<Event> Document::createEvent(const String& type, ExceptionCode& ec)
     4125{
     4126    // Please do *not* add new event classes to this function unless they are
     4127    // required for compatibility of some actual legacy web content.
     4128
     4129    // This mechanism is superceded by use of event constructors.
     4130    // That is what we should use for any new event classes.
     4131
     4132    // The following strings are the ones from the DOM specification
     4133    // <https://dom.spec.whatwg.org/#dom-document-createevent>.
     4134
     4135    if (equalIgnoringASCIICase(type, "customevent"))
     4136        return CustomEvent::create();
     4137    if (equalIgnoringASCIICase(type, "event") || equalIgnoringASCIICase(type, "events") || equalIgnoringASCIICase(type, "htmlevents"))
     4138        return Event::create();
     4139    if (equalIgnoringASCIICase(type, "keyboardevent") || equalIgnoringASCIICase(type, "keyboardevents"))
     4140        return KeyboardEvent::create();
     4141    if (equalIgnoringASCIICase(type, "messageevent"))
     4142        return MessageEvent::create();
     4143    if (equalIgnoringASCIICase(type, "mouseevent") || equalIgnoringASCIICase(type, "mouseevents"))
     4144        return MouseEvent::create();
     4145    if (equalIgnoringASCIICase(type, "uievent") || equalIgnoringASCIICase(type, "uievents"))
     4146        return UIEvent::create();
     4147
     4148#if ENABLE(TOUCH_EVENTS)
     4149    if (equalIgnoringASCIICase(type, "touchevent"))
     4150        return TouchEvent::create();
     4151#endif
     4152
     4153    // The following string comes from the SVG specifications
     4154    // <http://www.w3.org/TR/SVG/script.html#InterfaceSVGZoomEvent>
     4155    // <http://www.w3.org/TR/SVG2/interact.html#InterfaceSVGZoomEvent>.
     4156    // However, since there is no provision for initializing the event once it is created,
     4157    // there is no practical value in this feature.
     4158
     4159    if (equalIgnoringASCIICase(type, "svgzoomevents"))
     4160        return SVGZoomEvent::create();
     4161
     4162    // The following strings are for event classes where WebKit supplies an init function.
     4163    // These strings are not part of the DOM specification and we would like to eliminate them.
     4164    // However, we currently include these because we have concerns about backward compatibility.
     4165
     4166    // FIXME: For each of the strings below, prove there is no content depending on it and remove
     4167    // both the string and the corresponding init function for that class.
     4168
     4169    if (equalIgnoringASCIICase(type, "compositionevent"))
     4170        return CompositionEvent::create();
     4171    if (equalIgnoringASCIICase(type, "hashchangeevent"))
     4172        return HashChangeEvent::create();
     4173    if (equalIgnoringASCIICase(type, "mutationevent") || equalIgnoringASCIICase(type, "mutationevents"))
     4174        return MutationEvent::create();
     4175    if (equalIgnoringASCIICase(type, "overflowevent"))
     4176        return OverflowEvent::create();
     4177    if (equalIgnoringASCIICase(type, "storageevent"))
     4178        return StorageEvent::create();
     4179    if (equalIgnoringASCIICase(type, "textevent"))
     4180        return TextEvent::create();
     4181    if (equalIgnoringASCIICase(type, "wheelevent"))
     4182        return WheelEvent::create();
     4183
     4184#if ENABLE(DEVICE_ORIENTATION)
     4185    if (equalIgnoringASCIICase(type, "devicemotionevent"))
     4186        return DeviceMotionEvent::create();
     4187    if (equalIgnoringASCIICase(type, "deviceorientationevent"))
     4188        return DeviceOrientationEvent::create();
     4189#endif
    41154190
    41164191    ec = NOT_SUPPORTED_ERR;
Note: See TracChangeset for help on using the changeset viewer.