Title: [222348] trunk
Revision
222348
Author
[email protected]
Date
2017-09-21 13:46:53 -0700 (Thu, 21 Sep 2017)

Log Message

eventInitDict parameter to GamepadEvent constructor should be optional
https://bugs.webkit.org/show_bug.cgi?id=177308

Reviewed by Sam Weinig.

Source/WebCore:

eventInitDict parameter to GamepadEvent constructor should be optional to match Firefox
and Chrome. Having such dictionary parameter is also not valid Web IDL:
"""
If the type of an argument is a dictionary type (or a union type that has a dictionary as one
of its flattened member types), and that dictionary type and its ancestors have no required
members, and the argument is either the final argument or is followed only by optional arguments,
then the argument must be specified as optional. Such arguments are always considered to have a
default value of an empty dictionary, unless otherwise specified.
"""

Test: gamepad/gamepad-event.html

* Modules/gamepad/GamepadEvent.idl:

LayoutTests:

Add layout test coverage.

* gamepad/gamepad-event-expected.txt: Added.
* gamepad/gamepad-event.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (222347 => 222348)


--- trunk/LayoutTests/ChangeLog	2017-09-21 20:45:19 UTC (rev 222347)
+++ trunk/LayoutTests/ChangeLog	2017-09-21 20:46:53 UTC (rev 222348)
@@ -1,3 +1,15 @@
+2017-09-21  Chris Dumez  <[email protected]>
+
+        eventInitDict parameter to GamepadEvent constructor should be optional
+        https://bugs.webkit.org/show_bug.cgi?id=177308
+
+        Reviewed by Sam Weinig.
+
+        Add layout test coverage.
+
+        * gamepad/gamepad-event-expected.txt: Added.
+        * gamepad/gamepad-event.html: Added.
+
 2017-09-21  Ryan Haddad  <[email protected]>
 
         Mark imported/w3c/web-platform-tests/FileAPI/historical.https.html as flaky on El Capitan Debug WK2.

Added: trunk/LayoutTests/gamepad/gamepad-event-expected.txt (0 => 222348)


--- trunk/LayoutTests/gamepad/gamepad-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/gamepad/gamepad-event-expected.txt	2017-09-21 20:46:53 UTC (rev 222348)
@@ -0,0 +1,22 @@
+Tests the GamepadEvent constructor
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS new GamepadEvent() threw exception TypeError: Not enough arguments.
+PASS event = new GamepadEvent('test') did not throw exception.
+PASS event.type is "test"
+PASS event.gamepad is null
+PASS event.bubbles is false
+PASS event.cancelable is false
+PASS event.composed is false
+PASS event = new GamepadEvent('test', {'bubbles': true, 'cancelable': true, 'composed': true }) did not throw exception.
+PASS event.gamepad is null
+PASS event.bubbles is true
+PASS event.cancelable is true
+PASS event.composed is true
+PASS navigator.getGamepads is defined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/gamepad/gamepad-event.html (0 => 222348)


--- trunk/LayoutTests/gamepad/gamepad-event.html	                        (rev 0)
+++ trunk/LayoutTests/gamepad/gamepad-event.html	2017-09-21 20:46:53 UTC (rev 222348)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+    description("Tests the GamepadEvent constructor");
+
+    shouldThrowErrorName("new GamepadEvent()", "TypeError");
+    shouldNotThrow("event = new GamepadEvent('test')");
+    shouldBeEqualToString("event.type", "test");
+    shouldBeNull("event.gamepad");
+    shouldBeFalse("event.bubbles");
+    shouldBeFalse("event.cancelable");
+    shouldBeFalse("event.composed");
+
+    shouldNotThrow("event = new GamepadEvent('test', {'bubbles': true, 'cancelable': true, 'composed': true })");
+    shouldBeNull("event.gamepad");
+    shouldBeTrue("event.bubbles");
+    shouldBeTrue("event.cancelable");
+    shouldBeTrue("event.composed");
+
+    shouldBeDefined("navigator.getGamepads");
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (222347 => 222348)


--- trunk/Source/WebCore/ChangeLog	2017-09-21 20:45:19 UTC (rev 222347)
+++ trunk/Source/WebCore/ChangeLog	2017-09-21 20:46:53 UTC (rev 222348)
@@ -1,3 +1,24 @@
+2017-09-21  Chris Dumez  <[email protected]>
+
+        eventInitDict parameter to GamepadEvent constructor should be optional
+        https://bugs.webkit.org/show_bug.cgi?id=177308
+
+        Reviewed by Sam Weinig.
+
+        eventInitDict parameter to GamepadEvent constructor should be optional to match Firefox
+        and Chrome. Having such dictionary parameter is also not valid Web IDL:
+        """
+        If the type of an argument is a dictionary type (or a union type that has a dictionary as one
+        of its flattened member types), and that dictionary type and its ancestors have no required
+        members, and the argument is either the final argument or is followed only by optional arguments,
+        then the argument must be specified as optional. Such arguments are always considered to have a
+        default value of an empty dictionary, unless otherwise specified.
+        """
+
+        Test: gamepad/gamepad-event.html
+
+        * Modules/gamepad/GamepadEvent.idl:
+
 2017-09-21  Brian Burg  <[email protected]>
 
         Web Inspector: keyboard shortcut for "Reload page from origin" doesn't match Safari, and doesn't work

Modified: trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl (222347 => 222348)


--- trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl	2017-09-21 20:45:19 UTC (rev 222347)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl	2017-09-21 20:46:53 UTC (rev 222348)
@@ -25,7 +25,7 @@
 
 [
     Conditional=GAMEPAD,
-    Constructor(DOMString type, GamepadEventInit eventInitDict),
+    Constructor(DOMString type, optional GamepadEventInit eventInitDict),
     EnabledAtRuntime=Gamepads,
 ] interface GamepadEvent : Event {
     readonly attribute Gamepad? gamepad;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to