Title: [203539] trunk
Revision
203539
Author
[email protected]
Date
2016-07-21 16:52:35 -0700 (Thu, 21 Jul 2016)

Log Message

Make parameters to Document.getElementsBy*() operations mandatory
https://bugs.webkit.org/show_bug.cgi?id=160050

Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

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

Source/WebCore:

Make parameters to Document.getElementsBy*() operations mandatory to
match the specification:
- https://dom.spec.whatwg.org/#interface-document

Firefox and Chrome agree with the specification so the compatibility
risk should be low.

It makes very little sense to call these operations without parameter,
especially considering WebKit uses the string "undefined" if the
parameter is omitted.

No new tests, rebaselined existing tests.

* dom/Document.idl:

LayoutTests:

Drop cases that were calling the operation without parameter.

* fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt:
* fast/dom/getElementsByClassName/dumpHTMLCollection.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203538 => 203539)


--- trunk/LayoutTests/ChangeLog	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/ChangeLog	2016-07-21 23:52:35 UTC (rev 203539)
@@ -1,3 +1,15 @@
+2016-07-21  Chris Dumez  <[email protected]>
+
+        Make parameters to Document.getElementsBy*() operations mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160050
+
+        Reviewed by Daniel Bates.
+
+        Drop cases that were calling the operation without parameter.
+
+        * fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt:
+        * fast/dom/getElementsByClassName/dumpHTMLCollection.html:
+
 2016-07-21  Nan Wang  <[email protected]>
 
         AX: aria-label not being used correctly in accessible name calculation of heading

Modified: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt (203538 => 203539)


--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection-expected.txt	2016-07-21 23:52:35 UTC (rev 203539)
@@ -13,7 +13,6 @@
 length: 0
 length: 0
 length: 0
-length: 0
 [object HTMLDivElement], length: 1
 [object HTMLDivElement], [object HTMLParagraphElement], length: 2
 [object HTMLDivElement], length: 1
@@ -22,5 +21,4 @@
 length: 0
 length: 0
 length: 0
-length: 0
 

Modified: trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html (203538 => 203539)


--- trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/fast/dom/getElementsByClassName/dumpHTMLCollection.html	2016-07-21 23:52:35 UTC (rev 203539)
@@ -33,7 +33,6 @@
         log(document.getElementsByClassName("one\t\t\n \ftwo").dump());
         log(document.getElementsByClassName("").dump());
         log(document.getElementsByClassName("onetwo").dump());
-        log(document.getElementsByClassName().dump());
         log(document.getElementsByClassName(null).dump());
         log(document.getElementsByClassName(undefined).dump());
 
@@ -43,7 +42,6 @@
         log(elm.getElementsByClassName("one\t\t\n \ftwo").dump());
         log(elm.getElementsByClassName("").dump());
         log(elm.getElementsByClassName("onetwo").dump());
-        log(elm.getElementsByClassName().dump());
         log(elm.getElementsByClassName(null).dump());
         log(elm.getElementsByClassName(undefined).dump());
     } catch (ex) {

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (203538 => 203539)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-07-21 23:52:35 UTC (rev 203539)
@@ -1,5 +1,17 @@
 2016-07-21  Chris Dumez  <[email protected]>
 
+        Make parameters to Document.getElementsBy*() operations mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160050
+
+        Reviewed by Daniel Bates.
+
+        Rebaseline several W3C tests now that more checks are passing.
+
+        * web-platform-tests/dom/interfaces-expected.txt:
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-07-21  Chris Dumez  <[email protected]>
+
         Make parameters mandatory for Document.create*() operations
         https://bugs.webkit.org/show_bug.cgi?id=160047
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt	2016-07-21 23:52:35 UTC (rev 203539)
@@ -255,9 +255,9 @@
 PASS Document interface: attribute contentType 
 PASS Document interface: attribute doctype 
 PASS Document interface: attribute documentElement 
-FAIL Document interface: operation getElementsByTagName(DOMString) assert_equals: property has wrong .length expected 1 but got 0
-FAIL Document interface: operation getElementsByTagNameNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0
-FAIL Document interface: operation getElementsByClassName(DOMString) assert_equals: property has wrong .length expected 1 but got 0
+PASS Document interface: operation getElementsByTagName(DOMString) 
+PASS Document interface: operation getElementsByTagNameNS(DOMString,DOMString) 
+PASS Document interface: operation getElementsByClassName(DOMString) 
 PASS Document interface: operation createElement(DOMString,ElementCreationOptions) 
 PASS Document interface: operation createElementNS(DOMString,DOMString,ElementCreationOptions) 
 PASS Document interface: operation createDocumentFragment() 
@@ -295,17 +295,11 @@
 PASS Document interface: new Document() must inherit property "doctype" with the proper type (9) 
 PASS Document interface: new Document() must inherit property "documentElement" with the proper type (10) 
 PASS Document interface: new Document() must inherit property "getElementsByTagName" with the proper type (11) 
-FAIL Document interface: calling getElementsByTagName(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 getElementsByTagName(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "getElementsByTagNameNS" with the proper type (12) 
-FAIL Document interface: calling getElementsByTagNameNS(DOMString,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 getElementsByTagNameNS(DOMString,DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "getElementsByClassName" with the proper type (13) 
-FAIL Document interface: calling getElementsByClassName(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 getElementsByClassName(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "createElement" with the proper type (14) 
 PASS Document interface: calling createElement(DOMString,ElementCreationOptions) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "createElementNS" with the proper type (15) 
@@ -449,17 +443,11 @@
 PASS Document interface: xmlDoc must inherit property "doctype" with the proper type (9) 
 PASS Document interface: xmlDoc must inherit property "documentElement" with the proper type (10) 
 PASS Document interface: xmlDoc must inherit property "getElementsByTagName" with the proper type (11) 
-FAIL Document interface: calling getElementsByTagName(DOMString) on xmlDoc 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 getElementsByTagName(DOMString) on xmlDoc with too few arguments must throw TypeError 
 PASS Document interface: xmlDoc must inherit property "getElementsByTagNameNS" with the proper type (12) 
-FAIL Document interface: calling getElementsByTagNameNS(DOMString,DOMString) on xmlDoc 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 getElementsByTagNameNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError 
 PASS Document interface: xmlDoc must inherit property "getElementsByClassName" with the proper type (13) 
-FAIL Document interface: calling getElementsByClassName(DOMString) on xmlDoc 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 getElementsByClassName(DOMString) on xmlDoc with too few arguments must throw TypeError 
 PASS Document interface: xmlDoc must inherit property "createElement" with the proper type (14) 
 PASS Document interface: calling createElement(DOMString,ElementCreationOptions) on xmlDoc with too few arguments must throw TypeError 
 PASS Document interface: xmlDoc must inherit property "createElementNS" with the proper type (15) 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-07-21 23:52:35 UTC (rev 203539)
@@ -28,7 +28,7 @@
 PASS Document interface: attribute links 
 PASS Document interface: attribute forms 
 FAIL Document interface: attribute scripts assert_true: The prototype object must have a property "scripts" expected true got false
-FAIL Document interface: operation getElementsByName(DOMString) assert_equals: property has wrong .length expected 1 but got 0
+PASS Document interface: operation getElementsByName(DOMString) 
 FAIL Document interface: attribute cssElementMap assert_true: The prototype object must have a property "cssElementMap" expected true got false
 PASS Document interface: attribute currentScript 
 FAIL Document interface: operation open(DOMString,DOMString) assert_own_property: interface prototype object missing non-static operation expected property "open" missing
@@ -135,17 +135,11 @@
 PASS Document interface: iframe.contentDocument must inherit property "doctype" with the proper type (9) 
 PASS Document interface: iframe.contentDocument must inherit property "documentElement" with the proper type (10) 
 PASS Document interface: iframe.contentDocument must inherit property "getElementsByTagName" with the proper type (11) 
-FAIL Document interface: calling getElementsByTagName(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 getElementsByTagName(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "getElementsByTagNameNS" with the proper type (12) 
-FAIL Document interface: calling getElementsByTagNameNS(DOMString,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 getElementsByTagNameNS(DOMString,DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "getElementsByClassName" with the proper type (13) 
-FAIL Document interface: calling getElementsByClassName(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 getElementsByClassName(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "createElement" with the proper type (14) 
 PASS Document interface: calling createElement(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 PASS Document interface: iframe.contentDocument must inherit property "createElementNS" with the proper type (15) 
@@ -198,9 +192,7 @@
 PASS Document interface: iframe.contentDocument must inherit property "forms" with the proper type (49) 
 PASS Document interface: iframe.contentDocument must inherit property "scripts" with the proper type (50) 
 PASS Document interface: iframe.contentDocument must inherit property "getElementsByName" with the proper type (51) 
-FAIL Document interface: calling getElementsByName(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 getElementsByName(DOMString) on iframe.contentDocument with too few arguments must throw TypeError 
 FAIL Document interface: iframe.contentDocument must inherit property "cssElementMap" with the proper type (52) assert_inherits: property "cssElementMap" not found in prototype chain
 PASS Document interface: iframe.contentDocument must inherit property "currentScript" with the proper type (53) 
 FAIL Document interface: iframe.contentDocument must inherit property "open" with the proper type (54) assert_inherits: property "open" found on object expected in prototype chain
@@ -425,17 +417,11 @@
 PASS Document interface: new Document() must inherit property "doctype" with the proper type (9) 
 PASS Document interface: new Document() must inherit property "documentElement" with the proper type (10) 
 PASS Document interface: new Document() must inherit property "getElementsByTagName" with the proper type (11) 
-FAIL Document interface: calling getElementsByTagName(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 getElementsByTagName(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "getElementsByTagNameNS" with the proper type (12) 
-FAIL Document interface: calling getElementsByTagNameNS(DOMString,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 getElementsByTagNameNS(DOMString,DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "getElementsByClassName" with the proper type (13) 
-FAIL Document interface: calling getElementsByClassName(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 getElementsByClassName(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "createElement" with the proper type (14) 
 PASS Document interface: calling createElement(DOMString) on new Document() with too few arguments must throw TypeError 
 PASS Document interface: new Document() must inherit property "createElementNS" with the proper type (15) 
@@ -488,9 +474,7 @@
 PASS Document interface: new Document() must inherit property "forms" with the proper type (49) 
 FAIL Document interface: new Document() must inherit property "scripts" with the proper type (50) assert_inherits: property "scripts" not found in prototype chain
 PASS Document interface: new Document() must inherit property "getElementsByName" with the proper type (51) 
-FAIL Document interface: calling getElementsByName(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 getElementsByName(DOMString) on new Document() with too few arguments must throw TypeError 
 FAIL Document interface: new Document() must inherit property "cssElementMap" with the proper type (52) assert_inherits: property "cssElementMap" not found in prototype chain
 PASS Document interface: new Document() must inherit property "currentScript" with the proper type (53) 
 FAIL Document interface: new Document() must inherit property "open" with the proper type (54) assert_inherits: property "open" not found in prototype chain
@@ -718,17 +702,11 @@
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "doctype" with the proper type (9) 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "documentElement" with the proper type (10) 
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "getElementsByTagName" with the proper type (11) 
-FAIL Document interface: calling getElementsByTagName(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 getElementsByTagName(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 "getElementsByTagNameNS" with the proper type (12) 
-FAIL Document interface: calling getElementsByTagNameNS(DOMString,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 getElementsByTagNameNS(DOMString,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 "getElementsByClassName" with the proper type (13) 
-FAIL Document interface: calling getElementsByClassName(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 getElementsByClassName(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 "createElement" with the proper type (14) 
 PASS Document interface: calling createElement(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 "createElementNS" with the proper type (15) 
@@ -781,9 +759,7 @@
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "forms" with the proper type (49) 
 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "scripts" with the proper type (50) assert_inherits: property "scripts" not found in prototype chain
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "getElementsByName" with the proper type (51) 
-FAIL Document interface: calling getElementsByName(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 getElementsByName(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 "cssElementMap" with the proper type (52) assert_inherits: property "cssElementMap" not found in prototype chain
 PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "currentScript" with the proper type (53) 
 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "open" with the proper type (54) assert_inherits: property "open" not found in prototype chain

Modified: trunk/Source/WebCore/ChangeLog (203538 => 203539)


--- trunk/Source/WebCore/ChangeLog	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/Source/WebCore/ChangeLog	2016-07-21 23:52:35 UTC (rev 203539)
@@ -1,3 +1,25 @@
+2016-07-21  Chris Dumez  <[email protected]>
+
+        Make parameters to Document.getElementsBy*() operations mandatory
+        https://bugs.webkit.org/show_bug.cgi?id=160050
+
+        Reviewed by Daniel Bates.
+
+        Make parameters to Document.getElementsBy*() operations mandatory to
+        match the specification:
+        - https://dom.spec.whatwg.org/#interface-document
+
+        Firefox and Chrome agree with the specification so the compatibility
+        risk should be low.
+
+        It makes very little sense to call these operations without parameter,
+        especially considering WebKit uses the string "undefined" if the
+        parameter is omitted.
+
+        No new tests, rebaselined existing tests.
+
+        * dom/Document.idl:
+
 2016-07-21  Nan Wang  <[email protected]>
 
         AX: aria-label not being used correctly in accessible name calculation of heading

Modified: trunk/Source/WebCore/dom/Document.idl (203538 => 203539)


--- trunk/Source/WebCore/dom/Document.idl	2016-07-21 23:47:53 UTC (rev 203538)
+++ trunk/Source/WebCore/dom/Document.idl	2016-07-21 23:52:35 UTC (rev 203539)
@@ -48,8 +48,7 @@
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString tagname);
 #else
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    HTMLCollection getElementsByTagName(optional DOMString tagname = "undefined");
+    HTMLCollection getElementsByTagName(DOMString tagname);
 #endif
 
     // Introduced in DOM Level 2:
@@ -62,8 +61,7 @@
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName);
 #else
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    HTMLCollection getElementsByTagNameNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined");
+    HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
 #endif
 
     // DOM Level 3 Core
@@ -186,8 +184,7 @@
     readonly attribute HTMLCollection anchors;
     readonly attribute DOMString lastModified;
 
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    NodeList getElementsByName([AtomicString] optional DOMString elementName = "undefined");
+    NodeList getElementsByName([AtomicString] DOMString elementName);
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     [PutForwards=href, Unforgeable] readonly attribute Location? location;
@@ -244,8 +241,7 @@
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString classNames);
 #else
-    // FIXME: Using "undefined" as default parameter value is wrong.
-    HTMLCollection getElementsByClassName(optional DOMString classNames = "undefined");
+    HTMLCollection getElementsByClassName(DOMString classNames);
 #endif
 
     readonly attribute Element? activeElement;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to