Title: [210559] trunk
Revision
210559
Author
cdu...@apple.com
Date
2017-01-10 13:59:15 -0800 (Tue, 10 Jan 2017)

Log Message

Make Event.initEvent()'s first parameter mandatory
https://bugs.webkit.org/show_bug.cgi?id=166894

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline existing W3C test now that we're closing to the specification.

* web-platform-tests/dom/interfaces-expected.txt:

Source/WebCore:

Make Event.initEvent()'s first parameter mandatory. As per the
specification, all parameters should be mandatory and we are
currently dicussing the possibility of making them optional in
the specification. However, having the first parameter optional
makes little sense as it would set the event's type to the string
"undefined".

Test: fast/events/initEvent-parameters.html

* dom/Event.idl:

LayoutTests:

Add layout test coverage.

* fast/events/initEvent-parameters-expected.txt: Added.
* fast/events/initEvent-parameters.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210558 => 210559)


--- trunk/LayoutTests/ChangeLog	2017-01-10 21:13:33 UTC (rev 210558)
+++ trunk/LayoutTests/ChangeLog	2017-01-10 21:59:15 UTC (rev 210559)
@@ -1,3 +1,15 @@
+2017-01-10  Chris Dumez  <cdu...@apple.com>
+
+        Make Event.initEvent()'s first parameter mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=166894
+
+        Reviewed by Alex Christensen.
+
+        Add layout test coverage.
+
+        * fast/events/initEvent-parameters-expected.txt: Added.
+        * fast/events/initEvent-parameters.html: Added.
+
 2017-01-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r210537.

Added: trunk/LayoutTests/fast/events/initEvent-parameters-expected.txt (0 => 210559)


--- trunk/LayoutTests/fast/events/initEvent-parameters-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/initEvent-parameters-expected.txt	2017-01-10 21:59:15 UTC (rev 210559)
@@ -0,0 +1,14 @@
+Tests that Event.initEvent()'s first parameter is mandatory.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.initEvent() threw exception TypeError: Not enough arguments.
+PASS event.initEvent('click') did not throw exception.
+PASS event.type is "click"
+PASS event.bubbles is false
+PASS event.cancelable is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/initEvent-parameters.html (0 => 210559)


--- trunk/LayoutTests/fast/events/initEvent-parameters.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/initEvent-parameters.html	2017-01-10 21:59:15 UTC (rev 210559)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that Event.initEvent()'s first parameter is mandatory.");
+var event = document.createEvent("Event");
+shouldThrowErrorName("event.initEvent()", "TypeError");
+shouldNotThrow("event.initEvent('click')");
+shouldBeEqualToString("event.type", "click");
+shouldBeFalse("event.bubbles");
+shouldBeFalse("event.cancelable");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (210558 => 210559)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-10 21:13:33 UTC (rev 210558)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-01-10 21:59:15 UTC (rev 210559)
@@ -1,3 +1,14 @@
+2017-01-10  Chris Dumez  <cdu...@apple.com>
+
+        Make Event.initEvent()'s first parameter mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=166894
+
+        Reviewed by Alex Christensen.
+
+        Rebaseline existing W3C test now that we're closing to the specification.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+
 2017-01-06  Chris Dumez  <cdu...@apple.com>
 
         Unreviewed, rebaseline W3C test after r210468.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt (210558 => 210559)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2017-01-10 21:13:33 UTC (rev 210558)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2017-01-10 21:59:15 UTC (rev 210559)
@@ -46,7 +46,7 @@
 PASS Event interface: document.createEvent("Event") must have own property "isTrusted" 
 PASS Event interface: document.createEvent("Event") must inherit property "timeStamp" with the proper type (15) 
 PASS Event interface: document.createEvent("Event") must inherit property "initEvent" with the proper type (16) 
-FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on document.createEvent("Event") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
+FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on document.createEvent("Event") with too few arguments must throw TypeError assert_throws: Called with 1 arguments function "function () {
             fn.apply(obj, args);
         }" did not throw
 PASS Event must be primary interface of new Event("foo") 
@@ -68,7 +68,7 @@
 PASS Event interface: new Event("foo") must have own property "isTrusted" 
 PASS Event interface: new Event("foo") must inherit property "timeStamp" with the proper type (15) 
 PASS Event interface: new Event("foo") must inherit property "initEvent" with the proper type (16) 
-FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on new Event("foo") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
+FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on new Event("foo") with too few arguments must throw TypeError assert_throws: Called with 1 arguments function "function () {
             fn.apply(obj, args);
         }" did not throw
 PASS CustomEvent interface: existence and properties of interface object 
@@ -100,7 +100,7 @@
 PASS Event interface: new CustomEvent("foo") must have own property "isTrusted" 
 PASS Event interface: new CustomEvent("foo") must inherit property "timeStamp" with the proper type (15) 
 PASS Event interface: new CustomEvent("foo") must inherit property "initEvent" with the proper type (16) 
-FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on new CustomEvent("foo") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
+FAIL Event interface: calling initEvent(DOMString,boolean,boolean) on new CustomEvent("foo") with too few arguments must throw TypeError assert_throws: Called with 1 arguments function "function () {
             fn.apply(obj, args);
         }" did not throw
 PASS EventTarget interface: existence and properties of interface object 

Modified: trunk/Source/WebCore/ChangeLog (210558 => 210559)


--- trunk/Source/WebCore/ChangeLog	2017-01-10 21:13:33 UTC (rev 210558)
+++ trunk/Source/WebCore/ChangeLog	2017-01-10 21:59:15 UTC (rev 210559)
@@ -1,3 +1,21 @@
+2017-01-10  Chris Dumez  <cdu...@apple.com>
+
+        Make Event.initEvent()'s first parameter mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=166894
+
+        Reviewed by Alex Christensen.
+
+        Make Event.initEvent()'s first parameter mandatory. As per the
+        specification, all parameters should be mandatory and we are
+        currently dicussing the possibility of making them optional in
+        the specification. However, having the first parameter optional
+        makes little sense as it would set the event's type to the string
+        "undefined".
+
+        Test: fast/events/initEvent-parameters.html
+
+        * dom/Event.idl:
+
 2017-01-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r210537.

Modified: trunk/Source/WebCore/dom/Event.idl (210558 => 210559)


--- trunk/Source/WebCore/dom/Event.idl	2017-01-10 21:13:33 UTC (rev 210558)
+++ trunk/Source/WebCore/dom/Event.idl	2017-01-10 21:59:15 UTC (rev 210559)
@@ -66,7 +66,7 @@
     void stopPropagation();
     void preventDefault();
 
-    void initEvent(optional DOMString type = "undefined", optional boolean bubbles = false, optional boolean cancelable = false);
+    void initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false);
 
     readonly attribute boolean defaultPrevented;
     void stopImmediatePropagation();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to