Title: [204063] trunk
Revision
204063
Author
cdu...@apple.com
Date
2016-08-02 19:56:05 -0700 (Tue, 02 Aug 2016)

Log Message

Drop custom bindings code for HTMLOptionsCollection.remove()
https://bugs.webkit.org/show_bug.cgi?id=160475

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:

Drop custom bindings code for HTMLOptionsCollection.remove() and use
overloading instead. The overload that take an HTMLOptionElement is
WebKit-specific and should probably be dropped at some point:
- https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection

This patch also fixes several bugs:
- The parameter is now mandatory. This is consistent with the
  specification, Firefox and Chrome.
- HTMLOptionsCollection.prototype.remove.length is now 1 instead of 0.

No new tests, rebaselined existing tests.

* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::remove): Deleted.
* html/HTMLOptionsCollection.idl:

LayoutTests:

Update existing tests to reflect behavior change.

* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
* js/dom/select-options-remove-expected.txt:
* js/resources/select-options-remove.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204062 => 204063)


--- trunk/LayoutTests/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/ChangeLog	2016-08-03 02:56:05 UTC (rev 204063)
@@ -1,3 +1,17 @@
+2016-08-02  Chris Dumez  <cdu...@apple.com>
+
+        Drop custom bindings code for HTMLOptionsCollection.remove()
+        https://bugs.webkit.org/show_bug.cgi?id=160475
+
+        Reviewed by Darin Adler.
+
+        Update existing tests to reflect behavior change.
+
+        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+        * js/dom/select-options-remove-expected.txt:
+        * js/resources/select-options-remove.js:
+
 2016-08-02  Nan Wang  <n_w...@apple.com>
 
         AX: Simulated touch events are not working on iOS

Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (204062 => 204063)


--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt	2016-08-03 02:56:05 UTC (rev 204063)
@@ -30,7 +30,7 @@
 PASS nonNumericPolicy('document.createElement("input").setSelectionRange(x, 0)') is 'any type allowed'
 PASS nonNumericPolicy('document.createElement("input").setSelectionRange(0, x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createHTMLOptionsCollection().add(document.createElement("option"), x)') is 'any type allowed'
-PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed'
+PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createHTMLSelectElement().remove(x)') is 'any type allowed'
 PASS nonNumericPolicy('createHTMLSelectElement().item(x)') is 'any type allowed (but not omitted)'
 PASS nonNumericPolicy('createHTMLTableElement().insertRow(x)') is 'any type allowed'

Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (204062 => 204063)


--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js	2016-08-03 02:56:05 UTC (rev 204063)
@@ -245,7 +245,7 @@
 // HTMLOptionsCollection
 
 shouldBe("nonNumericPolicy('createHTMLOptionsCollection().add(document.createElement(\"option\"), x)')", "'any type allowed'");
-shouldBe("nonNumericPolicy('createHTMLOptionsCollection().remove(x)')", "'any type allowed'");
+shouldBe("nonNumericPolicy('createHTMLOptionsCollection().remove(x)')", "'any type allowed (but not omitted)'");
 
 // HTMLSelectElement
 

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (204062 => 204063)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-08-03 02:56:05 UTC (rev 204063)
@@ -1,5 +1,16 @@
 2016-08-02  Chris Dumez  <cdu...@apple.com>
 
+        Drop custom bindings code for HTMLOptionsCollection.remove()
+        https://bugs.webkit.org/show_bug.cgi?id=160475
+
+        Reviewed by Darin Adler.
+
+        Rebaseline W3C test now that more checks are passing.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt:
+
+2016-08-02  Chris Dumez  <cdu...@apple.com>
+
         Drop custom bindings for FormData.append()
         https://bugs.webkit.org/show_bug.cgi?id=160466
 

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt	2016-08-03 02:56:05 UTC (rev 204063)
@@ -928,7 +928,7 @@
 PASS HTMLOptionsCollection interface: existence and properties of interface prototype object's "constructor" property 
 PASS HTMLOptionsCollection interface: attribute length 
 PASS HTMLOptionsCollection interface: operation add([object Object],[object Object],[object Object],[object Object]) 
-FAIL HTMLOptionsCollection interface: operation remove(long) assert_equals: property has wrong .length expected 1 but got 0
+PASS HTMLOptionsCollection interface: operation remove(long) 
 PASS HTMLOptionsCollection interface: attribute selectedIndex 
 FAIL HTMLOptionsCollection must be primary interface of document.createElement("select").options assert_equals: wrong typeof object expected "function" but got "object"
 FAIL Stringification of document.createElement("select").options assert_equals: wrong typeof object expected "function" but got "object"

Modified: trunk/LayoutTests/js/dom/select-options-remove-expected.txt (204062 => 204063)


--- trunk/LayoutTests/js/dom/select-options-remove-expected.txt	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/js/dom/select-options-remove-expected.txt	2016-08-03 02:56:05 UTC (rev 204063)
@@ -49,7 +49,7 @@
 PASS select1.selectedIndex is -1
 
 1.10 Remove no args from empty Options
-PASS select1.options.remove() is undefined
+PASS select1.options.remove() threw exception TypeError: Not enough arguments.
 PASS select1.options.length is 0
 PASS select1.selectedIndex is -1
 
@@ -143,8 +143,8 @@
 PASS select2.selectedIndex is 4
 PASS select2.options[0].value is 'K'
 
-2.11 Remove no args from non-empty Options
-PASS select2.options.remove() is undefined
+2.11 Remove index 0 from non-empty Options
+PASS select2.options.remove(0) is undefined
 PASS select2.options.length is 5
 PASS select2.selectedIndex is 3
 PASS select2.options[0].value is 'L'

Modified: trunk/LayoutTests/js/resources/select-options-remove.js (204062 => 204063)


--- trunk/LayoutTests/js/resources/select-options-remove.js	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/LayoutTests/js/resources/select-options-remove.js	2016-08-03 02:56:05 UTC (rev 204063)
@@ -67,7 +67,7 @@
 debug("");
 
 debug("1.10 Remove no args from empty Options");
-shouldBe("select1.options.remove()", "undefined");
+shouldThrowErrorName("select1.options.remove()", "TypeError");
 shouldBe("select1.options.length", "0");
 shouldBe("select1.selectedIndex", "-1");
 debug("");
@@ -193,8 +193,8 @@
 shouldBe("select2.options[0].value", "'K'");
 debug("");
 
-debug("2.11 Remove no args from non-empty Options");
-shouldBe("select2.options.remove()", "undefined");
+debug("2.11 Remove index 0 from non-empty Options");
+shouldBe("select2.options.remove(0)", "undefined");
 shouldBe("select2.options.length", "5");
 shouldBe("select2.selectedIndex", "3");
 shouldBe("select2.options[0].value", "'L'");

Modified: trunk/Source/WebCore/ChangeLog (204062 => 204063)


--- trunk/Source/WebCore/ChangeLog	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/Source/WebCore/ChangeLog	2016-08-03 02:56:05 UTC (rev 204063)
@@ -1,3 +1,26 @@
+2016-08-02  Chris Dumez  <cdu...@apple.com>
+
+        Drop custom bindings code for HTMLOptionsCollection.remove()
+        https://bugs.webkit.org/show_bug.cgi?id=160475
+
+        Reviewed by Darin Adler.
+
+        Drop custom bindings code for HTMLOptionsCollection.remove() and use
+        overloading instead. The overload that take an HTMLOptionElement is
+        WebKit-specific and should probably be dropped at some point:
+        - https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection
+
+        This patch also fixes several bugs:
+        - The parameter is now mandatory. This is consistent with the
+          specification, Firefox and Chrome.
+        - HTMLOptionsCollection.prototype.remove.length is now 1 instead of 0.
+
+        No new tests, rebaselined existing tests.
+
+        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+        (WebCore::JSHTMLOptionsCollection::remove): Deleted.
+        * html/HTMLOptionsCollection.idl:
+
 2016-08-02  Nan Wang  <n_w...@apple.com>
 
         AX: Simulated touch events are not working on iOS

Modified: trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp (204062 => 204063)


--- trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp	2016-08-03 02:56:05 UTC (rev 204063)
@@ -70,15 +70,4 @@
     selectIndexSetter(&wrapped().selectElement(), exec, index, value);
 }
 
-JSValue JSHTMLOptionsCollection::remove(ExecState& state)
-{
-    // The argument can be an HTMLOptionElement or an index.
-    JSValue argument = state.argument(0);
-    if (HTMLOptionElement* option = JSHTMLOptionElement::toWrapped(argument))
-        wrapped().remove(*option);
-    else
-        wrapped().remove(argument.toInt32(&state));
-    return jsUndefined();
 }
-
-}

Modified: trunk/Source/WebCore/html/HTMLOptionsCollection.idl (204062 => 204063)


--- trunk/Source/WebCore/html/HTMLOptionsCollection.idl	2016-08-03 02:38:35 UTC (rev 204062)
+++ trunk/Source/WebCore/html/HTMLOptionsCollection.idl	2016-08-03 02:56:05 UTC (rev 204063)
@@ -42,8 +42,13 @@
 #else
     [RaisesException] void add(HTMLOptionElement option, unsigned long index);
 #endif
-    [Custom] void remove(optional unsigned long index);
 
+    void remove(long index);
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+    // FIXME: This overload is not in the specification and has been dropped in Blink.
+    void remove(HTMLOptionElement option);
+#endif
+
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
     Node item(unsigned long index);
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to