Title: [193957] trunk
Revision
193957
Author
da...@apple.com
Date
2015-12-11 09:35:52 -0800 (Fri, 11 Dec 2015)

Log 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:

* TestExpectations: Added expected failures for the two tests that depend
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.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (193956 => 193957)


--- trunk/LayoutTests/ChangeLog	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/ChangeLog	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,3 +1,35 @@
+2015-12-11  Darin Adler  <da...@apple.com>
+
+        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.
+
+        * TestExpectations: Added expected failures for the two tests that depend
+        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.
+
 2015-12-11  Nikita Vasilyev  <nvasil...@apple.com>
 
         Web Inspector: When logging strings, detect stack traces and show them as StackTraceView

Modified: trunk/LayoutTests/TestExpectations (193956 => 193957)


--- trunk/LayoutTests/TestExpectations	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/TestExpectations	2015-12-11 17:35:52 UTC (rev 193957)
@@ -649,6 +649,11 @@
 
 webkit.org/b/144258 [ Debug ] js/class-syntax-semicolon.html [ Skip ]
 
+# IDBVersionChangeEvent tests need to be rewritten to use event constructors instead of createEvent,
+# after we implement the IDBVersionChangeEvent constructor.
+webkit.org/b/145390 storage/indexeddb/events.html [ Failure ]
+webkit.org/b/145390 storage/indexeddb/removed.html [ Failure ]
+
 webkit.org/b/145390 storage/indexeddb/deleteIndex-bug110792.html [ Pass Failure ]
 
 # DumpRenderTree does not allow GIFs to animate, thus animated GIF tests don't work in WebKit1.

Modified: trunk/LayoutTests/animations/animation-events-create.html (193956 => 193957)


--- trunk/LayoutTests/animations/animation-events-create.html	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/animations/animation-events-create.html	2015-12-11 17:35:52 UTC (rev 193957)
@@ -17,7 +17,7 @@
 debug("");
 debug("Test creation of WebKitAnimationEvent");
 
-var ev = document.createEvent("WebKitAnimationEvent");
+var ev = new WebKitAnimationEvent("");
 
 shouldBe("typeof(ev)", "'object'");
 shouldBe("ev.animationName", "''");

Modified: trunk/LayoutTests/fast/events/event-creation-expected.txt (193956 => 193957)


--- trunk/LayoutTests/fast/events/event-creation-expected.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/fast/events/event-creation-expected.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -9,21 +9,12 @@
 PASS document.createEvent('Events').constructor === window.Event is true
 PASS document.createEvent('HTMLEvents') instanceof window.Event is true
 PASS document.createEvent('HTMLEvents').constructor === window.Event is true
-PASS document.createEvent('AnimationEvent') instanceof window.AnimationEvent is true
-PASS document.createEvent('AnimationEvent') instanceof window.Event is true
-PASS document.createEvent('AnimationEvent').constructor === window.AnimationEvent is true
-PASS document.createEvent('BeforeLoadEvent') instanceof window.BeforeLoadEvent is true
-PASS document.createEvent('BeforeLoadEvent') instanceof window.Event is true
-PASS document.createEvent('BeforeLoadEvent').constructor === window.BeforeLoadEvent is true
 PASS document.createEvent('CompositionEvent') instanceof window.CompositionEvent is true
 PASS document.createEvent('CompositionEvent') instanceof window.Event is true
 PASS document.createEvent('CompositionEvent').constructor === window.CompositionEvent is true
 PASS document.createEvent('CustomEvent') instanceof window.CustomEvent is true
 PASS document.createEvent('CustomEvent') instanceof window.Event is true
 PASS document.createEvent('CustomEvent').constructor === window.CustomEvent is true
-PASS document.createEvent('ErrorEvent') instanceof window.ErrorEvent is true
-PASS document.createEvent('ErrorEvent') instanceof window.Event is true
-PASS document.createEvent('ErrorEvent').constructor === window.ErrorEvent is true
 PASS document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent is true
 PASS document.createEvent('HashChangeEvent') instanceof window.Event is true
 PASS document.createEvent('HashChangeEvent').constructor === window.HashChangeEvent is true
@@ -55,15 +46,6 @@
 PASS document.createEvent('OverflowEvent') instanceof window.OverflowEvent is true
 PASS document.createEvent('OverflowEvent') instanceof window.Event is true
 PASS document.createEvent('OverflowEvent').constructor === window.OverflowEvent is true
-PASS document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent is true
-PASS document.createEvent('PageTransitionEvent') instanceof window.Event is true
-PASS document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent is true
-PASS document.createEvent('PopStateEvent') instanceof window.PopStateEvent is true
-PASS document.createEvent('PopStateEvent') instanceof window.Event is true
-PASS document.createEvent('PopStateEvent').constructor === window.PopStateEvent is true
-PASS document.createEvent('ProgressEvent') instanceof window.ProgressEvent is true
-PASS document.createEvent('ProgressEvent') instanceof window.Event is true
-PASS document.createEvent('ProgressEvent').constructor === window.ProgressEvent is true
 PASS document.createEvent('TextEvent') instanceof window.TextEvent is true
 PASS document.createEvent('TextEvent') instanceof window.UIEvent is true
 PASS document.createEvent('TextEvent') instanceof window.Event is true
@@ -74,38 +56,17 @@
 PASS document.createEvent('UIEvents') instanceof window.UIEvent is true
 PASS document.createEvent('UIEvents') instanceof window.Event is true
 PASS document.createEvent('UIEvents').constructor === window.UIEvent is true
-PASS document.createEvent('TransitionEvent') instanceof window.TransitionEvent is true
-PASS document.createEvent('TransitionEvent') instanceof window.Event is true
-PASS document.createEvent('TransitionEvent').constructor === window.TransitionEvent is true
-PASS document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent is true
-PASS document.createEvent('WebKitAnimationEvent') instanceof window.Event is true
-PASS document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent is true
-PASS document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent is true
-PASS document.createEvent('WebKitTransitionEvent') instanceof window.Event is true
-PASS document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.WheelEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.MouseEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.UIEvent is true
 PASS document.createEvent('WheelEvent') instanceof window.Event is true
 PASS document.createEvent('WheelEvent').constructor === window.WheelEvent is true
-PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent is true
-PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent is true
-PASS document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event is true
-PASS document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent is true
 PASS document.createEvent('StorageEvent') instanceof window.StorageEvent is true
 PASS document.createEvent('StorageEvent') instanceof window.Event is true
 PASS document.createEvent('StorageEvent').constructor === window.StorageEvent is true
-PASS document.createEvent('SVGEvents') instanceof window.Event is true
-PASS document.createEvent('SVGEvents').constructor === window.Event is true
-PASS document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent is true
-PASS document.createEvent('SVGZoomEvent') instanceof window.Event is true
-PASS document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent is true
 PASS document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent is true
 PASS document.createEvent('SVGZoomEvents') instanceof window.Event is true
 PASS document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent is true
-PASS document.createEvent('CloseEvent') instanceof window.CloseEvent is true
-PASS document.createEvent('CloseEvent') instanceof window.Event is true
-PASS document.createEvent('CloseEvent').constructor === window.CloseEvent is true
 PASS allEventInterfacesCreateEvents is true
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/events/event-creation.html (193956 => 193957)


--- trunk/LayoutTests/fast/events/event-creation.html	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/fast/events/event-creation.html	2015-12-11 17:35:52 UTC (rev 193957)
@@ -17,16 +17,6 @@
     shouldBeTrue("document.createEvent('HTMLEvents') instanceof window.Event");
     shouldBeTrue("document.createEvent('HTMLEvents').constructor === window.Event");
 
-    // AnimationEvent
-    shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.AnimationEvent");
-    shouldBeTrue("document.createEvent('AnimationEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('AnimationEvent').constructor === window.AnimationEvent");
-
-    // BeforeLoadEvent
-    shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.BeforeLoadEvent");
-    shouldBeTrue("document.createEvent('BeforeLoadEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('BeforeLoadEvent').constructor === window.BeforeLoadEvent");
-
     // CompositionEvent
     shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.CompositionEvent");
     shouldBeTrue("document.createEvent('CompositionEvent') instanceof window.Event");
@@ -37,11 +27,6 @@
     shouldBeTrue("document.createEvent('CustomEvent') instanceof window.Event");
     shouldBeTrue("document.createEvent('CustomEvent').constructor === window.CustomEvent");
 
-    // ErrorEvent
-    shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.ErrorEvent");
-    shouldBeTrue("document.createEvent('ErrorEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('ErrorEvent').constructor === window.ErrorEvent");
-
     // HashChangeEvent
     shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.HashChangeEvent");
     shouldBeTrue("document.createEvent('HashChangeEvent') instanceof window.Event");
@@ -91,21 +76,6 @@
     shouldBeTrue("document.createEvent('OverflowEvent') instanceof window.Event");
     shouldBeTrue("document.createEvent('OverflowEvent').constructor === window.OverflowEvent");
 
-    // PageTransitionEvent
-    shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.PageTransitionEvent");
-    shouldBeTrue("document.createEvent('PageTransitionEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('PageTransitionEvent').constructor === window.PageTransitionEvent");
-
-    // PopStateEvent
-    shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.PopStateEvent");
-    shouldBeTrue("document.createEvent('PopStateEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('PopStateEvent').constructor === window.PopStateEvent");
-
-    // ProgressEvent
-    shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.ProgressEvent");
-    shouldBeTrue("document.createEvent('ProgressEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('ProgressEvent').constructor === window.ProgressEvent");
-
     // TextEvent
     shouldBeTrue("document.createEvent('TextEvent') instanceof window.TextEvent");
     shouldBeTrue("document.createEvent('TextEvent') instanceof window.UIEvent");
@@ -122,21 +92,6 @@
     shouldBeTrue("document.createEvent('UIEvents') instanceof window.Event");
     shouldBeTrue("document.createEvent('UIEvents').constructor === window.UIEvent");
 
-    // TransitionEvent
-    shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.TransitionEvent");
-    shouldBeTrue("document.createEvent('TransitionEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('TransitionEvent').constructor === window.TransitionEvent");
-
-    // WebKitAnimationEvent
-    shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.WebKitAnimationEvent");
-    shouldBeTrue("document.createEvent('WebKitAnimationEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('WebKitAnimationEvent').constructor === window.WebKitAnimationEvent");
-
-    // WebKitTransitionEvent
-    shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.WebKitTransitionEvent");
-    shouldBeTrue("document.createEvent('WebKitTransitionEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('WebKitTransitionEvent').constructor === window.WebKitTransitionEvent");
-
     // WheelEvent
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.WheelEvent");
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.MouseEvent");
@@ -144,72 +99,18 @@
     shouldBeTrue("document.createEvent('WheelEvent') instanceof window.Event");
     shouldBeTrue("document.createEvent('WheelEvent').constructor === window.WheelEvent");
 
-    // XMLHttpRequestProgressEvent
-    shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.XMLHttpRequestProgressEvent");
-    shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.ProgressEvent");
-    shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('XMLHttpRequestProgressEvent').constructor === window.XMLHttpRequestProgressEvent");
-
     // StorageEvent
     shouldBeTrue("document.createEvent('StorageEvent') instanceof window.StorageEvent");
     shouldBeTrue("document.createEvent('StorageEvent') instanceof window.Event");
     shouldBeTrue("document.createEvent('StorageEvent').constructor === window.StorageEvent");
 
-    // #if ENABLE(SVG)
-    // SVGEvents (Event alternative)
-    shouldBeTrue("document.createEvent('SVGEvents') instanceof window.Event");
-    shouldBeTrue("document.createEvent('SVGEvents').constructor === window.Event");
-
-    // #if ENABLE(SVG)
-    // SVGZoomEvent
-    shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.SVGZoomEvent");
-    shouldBeTrue("document.createEvent('SVGZoomEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('SVGZoomEvent').constructor === window.SVGZoomEvent");
-
-    // #if ENABLE(SVG)
-    // SVGZoomEvents (SVGZoomEvent alternative)
+    // SVGZoomEvents
     shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.SVGZoomEvent");
     shouldBeTrue("document.createEvent('SVGZoomEvents') instanceof window.Event");
     shouldBeTrue("document.createEvent('SVGZoomEvents').constructor === window.SVGZoomEvent");
 
-    // #if ENABLE(WEB_SOCKETS)
-    // CloseEvent
-    shouldBeTrue("document.createEvent('CloseEvent') instanceof window.CloseEvent");
-    shouldBeTrue("document.createEvent('CloseEvent') instanceof window.Event");
-    shouldBeTrue("document.createEvent('CloseEvent').constructor === window.CloseEvent");
+    // The following are here for completeness, but we won't run these tests until they are supported in more ports.
 
-    // The following are here for completeness, but won't until there is more widespread support for them.
-
-    // #if ENABLE(WEB_AUDIO)
-    // AudioProcessingEvent
-    // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.AudioProcessingEvent");
-    // shouldBeTrue("document.createEvent('AudioProcessingEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('AudioProcessingEvent').constructor === window.AudioProcessingEvent");
-
-    // #if ENABLE(WEB_AUDIO)
-    // OfflineAudioCompletionEvent
-    // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.OfflineAudioCompletionEvent");
-    // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('OfflineAudioCompletionEvent').constructor === window.OfflineAudioCompletionEvent");
-
-    // #if ENABLE(INPUT_SPEECH)
-    // MediaStreamEvent
-    // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.MediaStreamEvent");
-    // shouldBeTrue("document.createEvent('MediaStreamEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('MediaStreamEvent').constructor === window.MediaStreamEvent");
-
-    // #if ENABLE(INPUT_SPEECH)
-    // SpeechInputEvent
-    // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.SpeechInputEvent");
-    // shouldBeTrue("document.createEvent('SpeechInputEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('SpeechInputEvent').constructor === window.SpeechInputEvent");
-
-    // #if ENABLE(WEBGL)
-    // WebGLContextEvent
-    // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.WebGLContextEvent");
-    // shouldBeTrue("document.createEvent('WebGLContextEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('WebGLContextEvent').constructor === window.WebGLContextEvent");
-
     // #if ENABLE(TOUCH_EVENTS)
     // TouchEvent
     // shouldBeTrue("document.createEvent('TouchEvent') instanceof window.TouchEvent");
@@ -228,17 +129,6 @@
     // shouldBeTrue("document.createEvent('DeviceOrientationEvent') instanceof window.Event");
     // shouldBeTrue("document.createEvent('DeviceOrientationEvent').constructor === window.DeviceOrientationEvent");
 
-    // #if ENABLE(ORIENTATION_EVENTS)
-    // OrientationEvent (Event alternative)
-    // shouldBeTrue("document.createEvent('OrientationEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('OrientationEvent').constructor === window.Event");
-
-    // #if ENABLE(REQUEST_AUTOCOMPLETE)
-    // AutocompleteErrorEvent
-    // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.AutocompleteErrorEvent");
-    // shouldBeTrue("document.createEvent('AutocompleteErrorEvent') instanceof window.Event");
-    // shouldBeTrue("document.createEvent('AutocompleteErrorEvent').constructor === window.AutocompleteErrorEvent");
-
     // We test both a hard coded set and the automated set below (using enumeration) to ensure that a constructor being removed
     // from the window is caught a regression.
 
@@ -278,8 +168,5 @@
     }
     shouldBeTrue('allEventInterfacesCreateEvents');
 </script>
-
-
-
 <script src=""
 </body>

Modified: trunk/LayoutTests/imported/blink/plugins/plugin-synthetic-event-crash.html (193956 => 193957)


--- trunk/LayoutTests/imported/blink/plugins/plugin-synthetic-event-crash.html	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/imported/blink/plugins/plugin-synthetic-event-crash.html	2015-12-11 17:35:52 UTC (rev 193957)
@@ -24,17 +24,9 @@
     });
 });
 
-var event = document.createEvent("PopStateEvent");
-event.initEvent("touchmove", true, true);
-plugin.dispatchEvent(event);
-
-event = document.createEvent("PopStateEvent");
-event.initEvent("gesturescrollstart", true, true);
-plugin.dispatchEvent(event);
-
-event = document.createEvent("PopStateEvent");
-event.initEvent("mousewheel", true, true);
-plugin.dispatchEvent(event);
+plugin.dispatchEvent(new PopStateEvent("touchmove", { bubbles: true, cancelable: true }));
+plugin.dispatchEvent(new PopStateEvent("gesturescrollstart", { bubbles: true, cancelable: true }));
+plugin.dispatchEvent(new PopStateEvent("mousewheel", { bubbles: true, cancelable: true }));
 </script>
 </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (193956 => 193957)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,3 +1,14 @@
+2015-12-11  Darin Adler  <da...@apple.com>
+
+        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.
+
+        * 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.
+
 2015-12-09  Keith Rollin  <krol...@apple.com>
 
         form.elements should reflect the element ordering after the HTML tree builder algorithm

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/ProgressEvent-expected.txt (193956 => 193957)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/ProgressEvent-expected.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/ProgressEvent-expected.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,6 +1,4 @@
 
 FAIL Default event values. assert_equals: expected (boolean) false but got (undefined) undefined
-FAIL document.createEvent() should not work with ProgressEvent. assert_throws: function "function () {
-    document.createEvent("ProgressEvent")
-  }" did not throw
+PASS document.createEvent() should not work with ProgressEvent. 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt (193956 => 193957)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TrackEvent/createEvent-expected.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,4 +1,3 @@
 
-FAIL TrackEvent created with createEvent assert_throws: function "function () {
-        var ev = document.createEvent('Trac..." did not throw
+PASS TrackEvent created with createEvent 
 

Deleted: trunk/LayoutTests/indieui/create-uirequestevent-expected.txt (193956 => 193957)


--- trunk/LayoutTests/indieui/create-uirequestevent-expected.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/indieui/create-uirequestevent-expected.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,21 +0,0 @@
-Tests that document.createEvent() works with IndieUI events.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-[object UIRequestEvent]
-PASS typeof event == 'object' is true
-PASS 'type' in event is true
-PASS 'bubbles' in event is true
-PASS 'cancelable' in event is true
-PASS 'receiver' in event is true
-PASS typeof event.type is 'string'
-PASS typeof event.bubbles is 'boolean'
-PASS typeof event.cancelable is 'boolean'
-PASS typeof event.receiver is 'object'
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/indieui/create-uirequestevent.html (193956 => 193957)


--- trunk/LayoutTests/indieui/create-uirequestevent.html	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/indieui/create-uirequestevent.html	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,35 +0,0 @@
-<html>
-<head>
-<script src=""
-</head>
-<body>
-<script>
-description('Tests that document.createEvent() works with IndieUI events.');
-
-var eventTypes = new Array("UIRequestEvent");
-
-for (var k = 0; k < eventTypes.length; k++) {
-    var event = document.createEvent("UIRequestEvent");
-
-    debug(event);
-    shouldBeTrue("typeof event == 'object'");
-
-    shouldBeTrue("'type' in event");
-    shouldBeTrue("'bubbles' in event");
-    shouldBeTrue("'cancelable' in event");
-    shouldBeTrue("'receiver' in event");
-
-    shouldBe("typeof event.type", "'string'");
-    shouldBe("typeof event.bubbles", "'boolean'");
-    shouldBe("typeof event.cancelable", "'boolean'");
-    shouldBe("typeof event.receiver", "'object'");
-
-    debug("\n");
-}
-
-
-
-</script>
-<script src=""
-</body>
-</html>

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (193956 => 193957)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2015-12-11 17:35:52 UTC (rev 193957)
@@ -387,7 +387,6 @@
 storage/indexeddb/cursor-advance.html [ Skip ]
 storage/indexeddb/cursor-basics.html [ Skip ]
 storage/indexeddb/cursor-continue-validity.html [ Skip ]
-storage/indexeddb/cursor-continueprimarykey.html [ Skip ]
 storage/indexeddb/cursor-index-delete.html [ Skip ]
 storage/indexeddb/cursor-key-order.html [ Skip ]
 storage/indexeddb/cursor-leak.html [ Skip ] # Missing needed WKTR feature?
@@ -395,12 +394,10 @@
 storage/indexeddb/cursor-primary-key-order.html [ Skip ]
 storage/indexeddb/cursor-request-cycle.html [ Skip ] # Missing needed WKTR feature?
 storage/indexeddb/cursor-update.html [ Skip ]
-storage/indexeddb/data-corruption.html [ Skip ]
 storage/indexeddb/database-close.html [ Skip ]
 storage/indexeddb/database-quota.html [ Skip ]
 storage/indexeddb/duplicates.html [ Skip ] # Difference between null + undefined
 storage/indexeddb/events.html [ Skip ]
-storage/indexeddb/factory-basics.html [ Skip ] # indexedDB.webkitGetDatabaseNames is missing)
 storage/indexeddb/factory-cmp.html [ Skip ]
 storage/indexeddb/get-keyrange.html [ Skip ]
 storage/indexeddb/index-basics.html [ Skip ] # Difference between null + undefined

Deleted: trunk/LayoutTests/platform/wk2/storage/indexeddb/removed-expected.txt (193956 => 193957)


--- trunk/LayoutTests/platform/wk2/storage/indexeddb/removed-expected.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/platform/wk2/storage/indexeddb/removed-expected.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,18 +0,0 @@
-Ensure that some obsolete IndexedDB features are gone.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
-
-dbname = "removed.html"
-PASS self.webkitIDBDatabaseError is undefined.
-PASS 'IDBDatabaseException' in self is false
-PASS 'errorCode' in indexedDB.open(dbname) is false
-PASS 'setVersion' in IDBDatabase.prototype is false
-PASS document.createEvent('IDBUpgradeNeededEvent') threw exception Error: NotSupportedError: DOM Exception 9.
-PASS 'version' in document.createEvent('IDBVersionChangeEvent') is false
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Modified: trunk/LayoutTests/transitions/transition-end-event-create.html (193956 => 193957)


--- trunk/LayoutTests/transitions/transition-end-event-create.html	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/LayoutTests/transitions/transition-end-event-create.html	2015-12-11 17:35:52 UTC (rev 193957)
@@ -17,7 +17,7 @@
 debug("");
 debug("Test creation of WebKitTransitionEvent");
 
-var ev = document.createEvent("WebKitTransitionEvent");
+var ev = new WebKitTransitionEvent("");
 
 shouldBe("typeof(ev)", "'object'");
 shouldBe("ev.propertyName", "''");

Modified: trunk/Source/WebCore/CMakeLists.txt (193956 => 193957)


--- trunk/Source/WebCore/CMakeLists.txt	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-12-11 17:35:52 UTC (rev 193957)
@@ -3642,8 +3642,8 @@
 list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/HTMLNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/HTMLElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JSHTMLElementWrapperFactory.cpp)
 
 
-GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventNames.in EventFactory.cpp)
-list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventFactory.cpp)
+GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventNames.in EventInterfaces.h)
+list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/EventInterfaces.h)
 
 
 GENERATE_EVENT_FACTORY(${WEBCORE_DIR}/dom/EventTargetFactory.in EventTargetInterfaces.h)

Modified: trunk/Source/WebCore/ChangeLog (193956 => 193957)


--- trunk/Source/WebCore/ChangeLog	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/ChangeLog	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,3 +1,36 @@
+2015-12-11  Darin Adler  <da...@apple.com>
+
+        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.
+
+        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.
+
 2015-12-10  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: storage/indexeddb/objectstore-count.html fails.

Modified: trunk/Source/WebCore/DerivedSources.make (193956 => 193957)


--- trunk/Source/WebCore/DerivedSources.make	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/DerivedSources.make	2015-12-11 17:35:52 UTC (rev 193957)
@@ -799,7 +799,7 @@
     CSSValueKeywords.cpp \
     CSSValueKeywords.h \
     ColorData.cpp \
-    EventFactory.cpp \
+    EventInterfaces.h \
     EventTargetInterfaces.h \
     ExceptionCodeDescription.cpp \
     HTMLElementFactory.cpp \

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (193956 => 193957)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-12-11 17:35:52 UTC (rev 193957)
@@ -877,7 +877,6 @@
       <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">4819;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Production|x64'">4819;%(DisableSpecificWarnings)</DisableSpecificWarnings>
     </ClCompile>
-    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\EventFactory.cpp" />
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionCodeDescription.cpp" />
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\HTMLElementFactory.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (193956 => 193957)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-12-11 17:35:52 UTC (rev 193957)
@@ -5019,9 +5019,6 @@
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\StylePropertyShorthandFunctions.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
-    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\EventFactory.cpp">
-      <Filter>DerivedSources</Filter>
-    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\ExceptionCodeDescription.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (193956 => 193957)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-12-11 17:35:52 UTC (rev 193957)
@@ -3772,8 +3772,6 @@
 		97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */; };
 		97627B8E14FB3CEE002CDCA1 /* ContextDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		97627B9814FB5424002CDCA1 /* Supplementable.h in Headers */ = {isa = PBXBuildFile; fileRef = 97627B9714FB5424002CDCA1 /* Supplementable.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		97665013144FAA4200F6BB51 /* EventFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 97665011144FAA4200F6BB51 /* EventFactory.h */; };
-		9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9766504E144FBFFE00F6BB51 /* EventFactory.cpp */; };
 		9767CE0B145ABC13005E64DB /* ExceptionHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE09145ABC12005E64DB /* ExceptionHeaders.h */; };
 		9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */; };
 		976D6C78122B8A3D001FD1F7 /* Blob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C59122B8A3D001FD1F7 /* Blob.cpp */; };
@@ -11269,8 +11267,6 @@
 		97627B8B14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContextDestructionObserver.cpp; sourceTree = "<group>"; };
 		97627B8C14FB3CEE002CDCA1 /* ContextDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextDestructionObserver.h; sourceTree = "<group>"; };
 		97627B9714FB5424002CDCA1 /* Supplementable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Supplementable.h; sourceTree = "<group>"; };
-		97665011144FAA4200F6BB51 /* EventFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventFactory.h; sourceTree = "<group>"; };
-		9766504E144FBFFE00F6BB51 /* EventFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventFactory.cpp; sourceTree = "<group>"; };
 		9767CE09145ABC12005E64DB /* ExceptionHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionHeaders.h; sourceTree = "<group>"; };
 		9767CE0A145ABC13005E64DB /* ExceptionInterfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionInterfaces.h; sourceTree = "<group>"; };
 		976D6C59122B8A3D001FD1F7 /* Blob.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Blob.cpp; sourceTree = "<group>"; };
@@ -17279,7 +17275,6 @@
 				6565814809D13043000E61D7 /* CSSValueKeywords.h */,
 				9B3A8871145632F9003AE8F5 /* DOMDOMSettableTokenList.h */,
 				E1C6CFC21746D293007B87A1 /* DOMWindowConstructors.idl */,
-				9766504E144FBFFE00F6BB51 /* EventFactory.cpp */,
 				970B72A5145008EB00F00A37 /* EventHeaders.h */,
 				970B7289144FFAC600F00A37 /* EventInterfaces.h */,
 				97AA3CA3145237CC003E1DA6 /* EventTargetHeaders.h */,
@@ -23859,7 +23854,6 @@
 				418A06CE133C04D500CD379C /* EventDispatcher.h */,
 				BC60D9090D2A17CE00B9918F /* EventException.h */,
 				BC60D90A0D2A17CE00B9918F /* EventException.idl */,
-				97665011144FAA4200F6BB51 /* EventFactory.h */,
 				935FBC4409BA00B900E230B1 /* EventListener.h */,
 				85AFA7410AAF298400E84305 /* EventListener.idl */,
 				AD4495F1141FC08900541EDF /* EventListenerMap.cpp */,
@@ -25451,7 +25445,6 @@
 				4138D3351244054800323D33 /* EventContext.h in Headers */,
 				418A06D0133C04D500CD379C /* EventDispatcher.h in Headers */,
 				BC60D90C0D2A17CE00B9918F /* EventException.h in Headers */,
-				97665013144FAA4200F6BB51 /* EventFactory.h in Headers */,
 				93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
 				970B72A6145008EB00F00A37 /* EventHeaders.h in Headers */,
 				970B728A144FFAC600F00A37 /* EventInterfaces.h in Headers */,
@@ -29111,7 +29104,6 @@
 				85031B410A44EFC700F992E0 /* Event.cpp in Sources */,
 				4138D3361244054800323D33 /* EventContext.cpp in Sources */,
 				418A06D1133C04D500CD379C /* EventDispatcher.cpp in Sources */,
-				9766504F144FBFFE00F6BB51 /* EventFactory.cpp in Sources */,
 				93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */,
 				FE6938B61045D67E008EABB6 /* EventHandlerIOS.mm in Sources */,
 				93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,

Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (193956 => 193957)


--- trunk/Source/WebCore/dom/DOMImplementation.cpp	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp	2015-12-11 17:35:52 UTC (rev 193957)
@@ -192,6 +192,10 @@
         return isSupportedSVG10Feature(feature, version) || isSupportedSVG11Feature(feature, version);
     }
 
+    // FIXME: SVG specifications <http://www.w3.org/TR/SVG/script.html#InterfaceSVGZoomEvent>
+    // and <http://www.w3.org/TR/SVG2/interact.html#InterfaceSVGZoomEvent>
+    // say that we should return true for the feature "SVGZoomEvents".
+
     return true;
 }
 

Modified: trunk/Source/WebCore/dom/Document.cpp (193956 => 193957)


--- trunk/Source/WebCore/dom/Document.cpp	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/dom/Document.cpp	2015-12-11 17:35:52 UTC (rev 193957)
@@ -41,8 +41,10 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "Comment.h"
+#include "CompositionEvent.h"
 #include "ContentSecurityPolicy.h"
 #include "CookieJar.h"
+#include "CustomEvent.h"
 #include "DOMImplementation.h"
 #include "DOMNamedFlowCollection.h"
 #include "DOMWindow.h"
@@ -56,7 +58,6 @@
 #include "Editor.h"
 #include "ElementIterator.h"
 #include "EntityReference.h"
-#include "EventFactory.h"
 #include "EventHandler.h"
 #include "ExtensionStyleSheets.h"
 #include "FocusController.h"
@@ -98,6 +99,7 @@
 #include "InspectorInstrumentation.h"
 #include "JSLazyEventListener.h"
 #include "JSModuleLoader.h"
+#include "KeyboardEvent.h"
 #include "Language.h"
 #include "LoaderStrategy.h"
 #include "Logging.h"
@@ -106,12 +108,15 @@
 #include "MediaProducer.h"
 #include "MediaQueryList.h"
 #include "MediaQueryMatcher.h"
+#include "MessageEvent.h"
 #include "MouseEventWithHitTestResults.h"
+#include "MutationEvent.h"
 #include "NameNodeList.h"
 #include "NestingLevelIncrementer.h"
 #include "NodeIterator.h"
 #include "NodeRareData.h"
 #include "NodeWithIndex.h"
+#include "OverflowEvent.h"
 #include "PageConsoleClient.h"
 #include "PageGroup.h"
 #include "PageTransitionEvent.h"
@@ -133,6 +138,7 @@
 #include "SVGElementFactory.h"
 #include "SVGNames.h"
 #include "SVGTitleElement.h"
+#include "SVGZoomEvent.h"
 #include "SchemeRegistry.h"
 #include "ScopedEventQueue.h"
 #include "ScriptController.h"
@@ -146,15 +152,18 @@
 #include "SelectorQuery.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
+#include "StorageEvent.h"
 #include "StyleProperties.h"
 #include "StyleResolver.h"
 #include "StyleSheetContents.h"
 #include "StyleSheetList.h"
 #include "SubresourceLoader.h"
+#include "TextEvent.h"
 #include "TextNodeTraversal.h"
 #include "TransformSource.h"
 #include "TreeWalker.h"
 #include "VisitedLinkState.h"
+#include "WheelEvent.h"
 #include "XMLDocumentParser.h"
 #include "XMLNSNames.h"
 #include "XMLNames.h"
@@ -171,13 +180,17 @@
 #include <wtf/text/StringBuffer.h>
 #include <yarr/RegularExpression.h>
 
-#if ENABLE(XSLT)
-#include "XSLTProcessor.h"
+#if ENABLE(CSP_NEXT)
+#include "DOMSecurityPolicy.h"
 #endif
 
+#if ENABLE(DEVICE_ORIENTATION)
+#include "DeviceMotionEvent.h"
+#include "DeviceOrientationEvent.h"
+#endif
 
-#if ENABLE(TOUCH_EVENTS)
-#include "TouchList.h"
+#if ENABLE(FULLSCREEN_API)
+#include "RenderFullScreen.h"
 #endif
 
 #if PLATFORM(IOS)
@@ -197,14 +210,18 @@
 #include "GestureEvent.h"
 #endif
 
+#if ENABLE(IOS_TEXT_AUTOSIZING)
+#include "TextAutoSizing.h"
+#endif
+
 #if ENABLE(MATHML)
 #include "MathMLElement.h"
 #include "MathMLElementFactory.h"
 #include "MathMLNames.h"
 #endif
 
-#if ENABLE(FULLSCREEN_API)
-#include "RenderFullScreen.h"
+#if ENABLE(MEDIA_SESSION)
+#include "MediaSession.h"
 #endif
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
@@ -212,16 +229,13 @@
 #include "ScriptedAnimationController.h"
 #endif
 
-#if ENABLE(IOS_TEXT_AUTOSIZING)
-#include "TextAutoSizing.h"
-#endif
-
 #if ENABLE(TEXT_AUTOSIZING)
 #include "TextAutosizer.h"
 #endif
 
-#if ENABLE(CSP_NEXT)
-#include "DOMSecurityPolicy.h"
+#if ENABLE(TOUCH_EVENTS)
+#include "TouchEvent.h"
+#include "TouchList.h"
 #endif
 
 #if ENABLE(VIDEO_TRACK)
@@ -238,8 +252,8 @@
 #include "MediaPlaybackTargetClient.h"
 #endif
 
-#if ENABLE(MEDIA_SESSION)
-#include "MediaSession.h"
+#if ENABLE(XSLT)
+#include "XSLTProcessor.h"
 #endif
 
 using namespace WTF;
@@ -4107,12 +4121,73 @@
     m_eventQueue.enqueueEvent(WTF::move(event));
 }
 
-RefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec)
+RefPtr<Event> Document::createEvent(const String& type, ExceptionCode& ec)
 {
-    RefPtr<Event> event = EventFactory::create(eventType);
-    if (event)
-        return event.release();
+    // Please do *not* add new event classes to this function unless they are
+    // required for compatibility of some actual legacy web content.
 
+    // This mechanism is superceded by use of event constructors.
+    // That is what we should use for any new event classes.
+
+    // The following strings are the ones from the DOM specification
+    // <https://dom.spec.whatwg.org/#dom-document-createevent>.
+
+    if (equalIgnoringASCIICase(type, "customevent"))
+        return CustomEvent::create();
+    if (equalIgnoringASCIICase(type, "event") || equalIgnoringASCIICase(type, "events") || equalIgnoringASCIICase(type, "htmlevents"))
+        return Event::create();
+    if (equalIgnoringASCIICase(type, "keyboardevent") || equalIgnoringASCIICase(type, "keyboardevents"))
+        return KeyboardEvent::create();
+    if (equalIgnoringASCIICase(type, "messageevent"))
+        return MessageEvent::create();
+    if (equalIgnoringASCIICase(type, "mouseevent") || equalIgnoringASCIICase(type, "mouseevents"))
+        return MouseEvent::create();
+    if (equalIgnoringASCIICase(type, "uievent") || equalIgnoringASCIICase(type, "uievents"))
+        return UIEvent::create();
+
+#if ENABLE(TOUCH_EVENTS)
+    if (equalIgnoringASCIICase(type, "touchevent"))
+        return TouchEvent::create();
+#endif
+
+    // The following string comes from the SVG specifications
+    // <http://www.w3.org/TR/SVG/script.html#InterfaceSVGZoomEvent>
+    // <http://www.w3.org/TR/SVG2/interact.html#InterfaceSVGZoomEvent>.
+    // However, since there is no provision for initializing the event once it is created,
+    // there is no practical value in this feature.
+
+    if (equalIgnoringASCIICase(type, "svgzoomevents"))
+        return SVGZoomEvent::create();
+
+    // The following strings are for event classes where WebKit supplies an init function.
+    // These strings are not part of the DOM specification and we would like to eliminate them.
+    // However, we currently include these because we have concerns about backward compatibility.
+
+    // FIXME: For each of the strings below, prove there is no content depending on it and remove
+    // both the string and the corresponding init function for that class.
+
+    if (equalIgnoringASCIICase(type, "compositionevent"))
+        return CompositionEvent::create();
+    if (equalIgnoringASCIICase(type, "hashchangeevent"))
+        return HashChangeEvent::create();
+    if (equalIgnoringASCIICase(type, "mutationevent") || equalIgnoringASCIICase(type, "mutationevents"))
+        return MutationEvent::create();
+    if (equalIgnoringASCIICase(type, "overflowevent"))
+        return OverflowEvent::create();
+    if (equalIgnoringASCIICase(type, "storageevent"))
+        return StorageEvent::create();
+    if (equalIgnoringASCIICase(type, "textevent"))
+        return TextEvent::create();
+    if (equalIgnoringASCIICase(type, "wheelevent"))
+        return WheelEvent::create();
+
+#if ENABLE(DEVICE_ORIENTATION)
+    if (equalIgnoringASCIICase(type, "devicemotionevent"))
+        return DeviceMotionEvent::create();
+    if (equalIgnoringASCIICase(type, "deviceorientationevent"))
+        return DeviceOrientationEvent::create();
+#endif
+
     ec = NOT_SUPPORTED_ERR;
     return nullptr;
 }

Deleted: trunk/Source/WebCore/dom/EventFactory.h (193956 => 193957)


--- trunk/Source/WebCore/dom/EventFactory.h	2015-12-11 17:34:32 UTC (rev 193956)
+++ trunk/Source/WebCore/dom/EventFactory.h	2015-12-11 17:35:52 UTC (rev 193957)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2011 Google, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef EventFactory_h
-#define EventFactory_h
-
-#include "DOMWrapperWorld.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/text/AtomicString.h>
-
-namespace WebCore {
-
-class Event;
-
-class EventFactory {
-public:
-    static PassRefPtr<Event> create(const String& eventType);
-};
-
-}
-
-#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to