Title: [203784] trunk
Revision
203784
Author
[email protected]
Date
2016-07-27 11:27:22 -0700 (Wed, 27 Jul 2016)

Log Message

First parameter to Document.execCommand() / queryCommand*() should be mandatory
https://bugs.webkit.org/show_bug.cgi?id=160258

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline W3C test now that more checks are passing.

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

Source/WebCore:

First parameter to Document.execCommand() / queryCommand*() should be mandatory:
- https://w3c.github.io/editing/execCommand.html

Firefox and Chrome agree with the specification.

Test: fast/dom/Document/editing-parameters.html

* dom/Document.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/Document/editing-parameters-expected.txt: Added.
* fast/dom/Document/editing-parameters.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203783 => 203784)


--- trunk/LayoutTests/ChangeLog	2016-07-27 18:04:58 UTC (rev 203783)
+++ trunk/LayoutTests/ChangeLog	2016-07-27 18:27:22 UTC (rev 203784)
@@ -1,3 +1,15 @@
+2016-07-27  Chris Dumez  <[email protected]>
+
+        First parameter to Document.execCommand() / queryCommand*() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160258
+
+        Reviewed by Darin Adler.
+
+        Add layout test coverage.
+
+        * fast/dom/Document/editing-parameters-expected.txt: Added.
+        * fast/dom/Document/editing-parameters.html: Added.
+
 2016-07-27  Ryan Haddad  <[email protected]>
 
         Fix a typo in TestExpectations.

Added: trunk/LayoutTests/fast/dom/Document/editing-parameters-expected.txt (0 => 203784)


--- trunk/LayoutTests/fast/dom/Document/editing-parameters-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/editing-parameters-expected.txt	2016-07-27 18:27:22 UTC (rev 203784)
@@ -0,0 +1,15 @@
+Test that the parameters of the editing API on Document are mandatory.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.execCommand() threw exception TypeError: Not enough arguments.
+PASS document.queryCommandEnabled() threw exception TypeError: Not enough arguments.
+PASS document.queryCommandIndeterm() threw exception TypeError: Not enough arguments.
+PASS document.queryCommandState() threw exception TypeError: Not enough arguments.
+PASS document.queryCommandSupported() threw exception TypeError: Not enough arguments.
+PASS document.queryCommandValue() threw exception TypeError: Not enough arguments.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Document/editing-parameters.html (0 => 203784)


--- trunk/LayoutTests/fast/dom/Document/editing-parameters.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/editing-parameters.html	2016-07-27 18:27:22 UTC (rev 203784)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that the parameters of the editing API on Document are mandatory.");
+
+shouldThrow("document.execCommand()", "'TypeError: Not enough arguments'");
+shouldThrow("document.queryCommandEnabled()", "'TypeError: Not enough arguments'");
+shouldThrow("document.queryCommandIndeterm()", "'TypeError: Not enough arguments'");
+shouldThrow("document.queryCommandState()", "'TypeError: Not enough arguments'");
+shouldThrow("document.queryCommandSupported()", "'TypeError: Not enough arguments'");
+shouldThrow("document.queryCommandValue()", "'TypeError: Not enough arguments'");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203783 => 203784)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 18:04:58 UTC (rev 203783)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-27 18:27:22 UTC (rev 203784)
@@ -1,3 +1,14 @@
+2016-07-27  Chris Dumez  <[email protected]>
+
+        First parameter to Document.execCommand() / queryCommand*() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160258
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
 2016-07-26  Youenn Fablet  <[email protected]>
 
         [Fetch API] Response constructor should be able to take a ReadableStream as body

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 18:04:58 UTC (rev 203783)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-27 18:27:22 UTC (rev 203784)
@@ -40,12 +40,12 @@
 PASS Document interface: attribute activeElement 
 PASS Document interface: operation hasFocus() 
 FAIL Document interface: attribute designMode assert_true: The prototype object must have a property "designMode" expected true got false
-FAIL Document interface: operation execCommand(DOMString,boolean,DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation queryCommandEnabled(DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation queryCommandIndeterm(DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation queryCommandState(DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation queryCommandSupported(DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation queryCommandValue(DOMString) assert_equals: property has wrong .length expected 1 but got 0
+PASS Document interface: operation execCommand(DOMString,boolean,DOMString) 
+PASS Document interface: operation queryCommandEnabled(DOMString) 
+PASS Document interface: operation queryCommandIndeterm(DOMString) 
+PASS Document interface: operation queryCommandState(DOMString) 
+PASS Document interface: operation queryCommandSupported(DOMString) 
+PASS Document interface: operation queryCommandValue(DOMString) 
 FAIL Document interface: attribute commands assert_true: The prototype object must have a property "commands" expected true got false
 PASS Document interface: attribute onreadystatechange 
 FAIL Document interface: attribute fgColor assert_true: The prototype object must have a property "fgColor" expected true got false
@@ -207,29 +207,17 @@
 PASS Document interface: iframe.contentDocument must inherit property "hasFocus" with the proper type (61) 
 PASS Document interface: iframe.contentDocument must inherit property "designMode" with the proper type (62) 
 PASS Document interface: iframe.contentDocument must inherit property "execCommand" with the proper type (63) 
-FAIL Document interface: calling execCommand(DOMString,boolean,DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling execCommand(DOMString,boolean,DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "queryCommandEnabled" with the proper type (64) 
-FAIL Document interface: calling queryCommandEnabled(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandEnabled(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "queryCommandIndeterm" with the proper type (65) 
-FAIL Document interface: calling queryCommandIndeterm(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandIndeterm(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "queryCommandState" with the proper type (66) 
-FAIL Document interface: calling queryCommandState(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandState(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "queryCommandSupported" with the proper type (67) 
-FAIL Document interface: calling queryCommandSupported(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandSupported(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "queryCommandValue" with the proper type (68) 
-FAIL Document interface: calling queryCommandValue(DOMString) on iframe.contentDocument with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandValue(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 FAIL Document interface: iframe.contentDocument must inherit property "commands" with the proper type (69) assert_inherits: property "commands" not found in prototype chain
 PASS Document interface: iframe.contentDocument must inherit property "onreadystatechange" with the proper type (70) 
 PASS Document interface: iframe.contentDocument must inherit property "fgColor" with the proper type (71) 
@@ -471,29 +459,17 @@
 PASS Document interface: new Document() must inherit property "hasFocus" with the proper type (61) 
 FAIL Document interface: new Document() must inherit property "designMode" with the proper type (62) assert_inherits: property "designMode" not found in prototype chain
 PASS Document interface: new Document() must inherit property "execCommand" with the proper type (63) 
-FAIL Document interface: calling execCommand(DOMString,boolean,DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling execCommand(DOMString,boolean,DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "queryCommandEnabled" with the proper type (64) 
-FAIL Document interface: calling queryCommandEnabled(DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandEnabled(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "queryCommandIndeterm" with the proper type (65) 
-FAIL Document interface: calling queryCommandIndeterm(DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandIndeterm(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "queryCommandState" with the proper type (66) 
-FAIL Document interface: calling queryCommandState(DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandState(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "queryCommandSupported" with the proper type (67) 
-FAIL Document interface: calling queryCommandSupported(DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandSupported(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "queryCommandValue" with the proper type (68) 
-FAIL Document interface: calling queryCommandValue(DOMString) on new Document() with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandValue(DOMString) on new Document() with too few arguments must throw TypeError 
 FAIL Document interface: new Document() must inherit property "commands" with the proper type (69) assert_inherits: property "commands" not found in prototype chain
 PASS Document interface: new Document() must inherit property "onreadystatechange" with the proper type (70) 
 FAIL Document interface: new Document() must inherit property "fgColor" with the proper type (71) assert_inherits: property "fgColor" not found in prototype chain
@@ -738,29 +714,17 @@
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "hasFocus" with the proper type (61) 
 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "designMode" with the proper type (62) assert_inherits: property "designMode" not found in prototype chain
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "execCommand" with the proper type (63) 
-FAIL Document interface: calling execCommand(DOMString,boolean,DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling execCommand(DOMString,boolean,DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryCommandEnabled" with the proper type (64) 
-FAIL Document interface: calling queryCommandEnabled(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandEnabled(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryCommandIndeterm" with the proper type (65) 
-FAIL Document interface: calling queryCommandIndeterm(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandIndeterm(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryCommandState" with the proper type (66) 
-FAIL Document interface: calling queryCommandState(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandState(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryCommandSupported" with the proper type (67) 
-FAIL Document interface: calling queryCommandSupported(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandSupported(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "queryCommandValue" with the proper type (68) 
-FAIL Document interface: calling queryCommandValue(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
-            fn.apply(obj, args);
-        }" did not throw
+PASS Document interface: calling queryCommandValue(DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError 
 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "commands" with the proper type (69) assert_inherits: property "commands" not found in prototype chain
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onreadystatechange" with the proper type (70) 
 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "fgColor" with the proper type (71) assert_inherits: property "fgColor" not found in prototype chain

Modified: trunk/Source/WebCore/ChangeLog (203783 => 203784)


--- trunk/Source/WebCore/ChangeLog	2016-07-27 18:04:58 UTC (rev 203783)
+++ trunk/Source/WebCore/ChangeLog	2016-07-27 18:27:22 UTC (rev 203784)
@@ -1,5 +1,21 @@
 2016-07-27  Chris Dumez  <[email protected]>
 
+        First parameter to Document.execCommand() / queryCommand*() should be mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160258
+
+        Reviewed by Darin Adler.
+
+        First parameter to Document.execCommand() / queryCommand*() should be mandatory:
+        - https://w3c.github.io/editing/execCommand.html
+
+        Firefox and Chrome agree with the specification.
+
+        Test: fast/dom/Document/editing-parameters.html
+
+        * dom/Document.idl:
+
+2016-07-27  Chris Dumez  <[email protected]>
+
         Align CSSSupportsRule with the specification
         https://bugs.webkit.org/show_bug.cgi?id=160256
 

Modified: trunk/Source/WebCore/dom/Document.idl (203783 => 203784)


--- trunk/Source/WebCore/dom/Document.idl	2016-07-27 18:04:58 UTC (rev 203783)
+++ trunk/Source/WebCore/dom/Document.idl	2016-07-27 18:27:22 UTC (rev 203784)
@@ -140,24 +140,20 @@
                                                   optional XPathResult? inResult);
 
     // Common extensions
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    boolean execCommand(optional DOMString command = "undefined",
-                        optional boolean userInterface = false,
-                        optional DOMString? value = null);
+    // FIXME: The default value for the last parameter should be the empty string.
+    boolean execCommand(DOMString command, optional boolean userInterface = false, optional DOMString? value = null);
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     // FIXME: remove the these two versions once optional is implemented for Objective-C.
-    boolean            execCommand(DOMString command,
-                                   boolean userInterface);
-    boolean            execCommand(DOMString command);
+    boolean execCommand(DOMString command, boolean userInterface);
+    boolean execCommand(DOMString command);
 #endif
 
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    boolean            queryCommandEnabled(optional DOMString command = "undefined");
-    boolean            queryCommandIndeterm(optional DOMString command = "undefined");
-    boolean            queryCommandState(optional DOMString command = "undefined");
-    boolean            queryCommandSupported(optional DOMString command = "undefined");
-    DOMString          queryCommandValue(optional DOMString command = "undefined");
+    boolean queryCommandEnabled(DOMString command);
+    boolean queryCommandIndeterm(DOMString command);
+    boolean queryCommandState(DOMString command);
+    boolean queryCommandSupported(DOMString command);
+    DOMString queryCommandValue(DOMString command);
 
     // Moved down from HTMLDocument
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to