Changeset 204063 in webkit


Ignore:
Timestamp:
Aug 2, 2016 7:56:05 PM (8 years ago)
Author:
Chris Dumez
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:

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:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r204062 r204063  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop custom bindings code for HTMLOptionsCollection.remove()
     4        https://bugs.webkit.org/show_bug.cgi?id=160475
     5
     6        Reviewed by Darin Adler.
     7
     8        Update existing tests to reflect behavior change.
     9
     10        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
     11        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
     12        * js/dom/select-options-remove-expected.txt:
     13        * js/resources/select-options-remove.js:
     14
    1152016-08-02  Nan Wang  <n_wang@apple.com>
    216
  • trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt

    r203840 r204063  
    3131PASS nonNumericPolicy('document.createElement("input").setSelectionRange(0, x)') is 'any type allowed (but not omitted)'
    3232PASS nonNumericPolicy('createHTMLOptionsCollection().add(document.createElement("option"), x)') is 'any type allowed'
    33 PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed'
     33PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed (but not omitted)'
    3434PASS nonNumericPolicy('createHTMLSelectElement().remove(x)') is 'any type allowed'
    3535PASS nonNumericPolicy('createHTMLSelectElement().item(x)') is 'any type allowed (but not omitted)'
  • trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js

    r203840 r204063  
    246246
    247247shouldBe("nonNumericPolicy('createHTMLOptionsCollection().add(document.createElement(\"option\"), x)')", "'any type allowed'");
    248 shouldBe("nonNumericPolicy('createHTMLOptionsCollection().remove(x)')", "'any type allowed'");
     248shouldBe("nonNumericPolicy('createHTMLOptionsCollection().remove(x)')", "'any type allowed (but not omitted)'");
    249249
    250250// HTMLSelectElement
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r204048 r204063  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop custom bindings code for HTMLOptionsCollection.remove()
     4        https://bugs.webkit.org/show_bug.cgi?id=160475
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline W3C test now that more checks are passing.
     9
     10        * web-platform-tests/html/dom/interfaces-expected.txt:
     11
    1122016-08-02  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r203935 r204063  
    929929PASS HTMLOptionsCollection interface: attribute length
    930930PASS HTMLOptionsCollection interface: operation add([object Object],[object Object],[object Object],[object Object])
    931 FAIL HTMLOptionsCollection interface: operation remove(long) assert_equals: property has wrong .length expected 1 but got 0
     931PASS HTMLOptionsCollection interface: operation remove(long)
    932932PASS HTMLOptionsCollection interface: attribute selectedIndex
    933933FAIL HTMLOptionsCollection must be primary interface of document.createElement("select").options assert_equals: wrong typeof object expected "function" but got "object"
  • trunk/LayoutTests/js/dom/select-options-remove-expected.txt

    r156869 r204063  
    5050
    51511.10 Remove no args from empty Options
    52 PASS select1.options.remove() is undefined
     52PASS select1.options.remove() threw exception TypeError: Not enough arguments.
    5353PASS select1.options.length is 0
    5454PASS select1.selectedIndex is -1
     
    144144PASS select2.options[0].value is 'K'
    145145
    146 2.11 Remove no args from non-empty Options
    147 PASS select2.options.remove() is undefined
     1462.11 Remove index 0 from non-empty Options
     147PASS select2.options.remove(0) is undefined
    148148PASS select2.options.length is 5
    149149PASS select2.selectedIndex is 3
  • trunk/LayoutTests/js/resources/select-options-remove.js

    r156869 r204063  
    6868
    6969debug("1.10 Remove no args from empty Options");
    70 shouldBe("select1.options.remove()", "undefined");
     70shouldThrowErrorName("select1.options.remove()", "TypeError");
    7171shouldBe("select1.options.length", "0");
    7272shouldBe("select1.selectedIndex", "-1");
     
    194194debug("");
    195195
    196 debug("2.11 Remove no args from non-empty Options");
    197 shouldBe("select2.options.remove()", "undefined");
     196debug("2.11 Remove index 0 from non-empty Options");
     197shouldBe("select2.options.remove(0)", "undefined");
    198198shouldBe("select2.options.length", "5");
    199199shouldBe("select2.selectedIndex", "3");
  • trunk/Source/WebCore/ChangeLog

    r204062 r204063  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop custom bindings code for HTMLOptionsCollection.remove()
     4        https://bugs.webkit.org/show_bug.cgi?id=160475
     5
     6        Reviewed by Darin Adler.
     7
     8        Drop custom bindings code for HTMLOptionsCollection.remove() and use
     9        overloading instead. The overload that take an HTMLOptionElement is
     10        WebKit-specific and should probably be dropped at some point:
     11        - https://html.spec.whatwg.org/multipage/infrastructure.html#htmloptionscollection
     12
     13        This patch also fixes several bugs:
     14        - The parameter is now mandatory. This is consistent with the
     15          specification, Firefox and Chrome.
     16        - HTMLOptionsCollection.prototype.remove.length is now 1 instead of 0.
     17
     18        No new tests, rebaselined existing tests.
     19
     20        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
     21        (WebCore::JSHTMLOptionsCollection::remove): Deleted.
     22        * html/HTMLOptionsCollection.idl:
     23
    1242016-08-02  Nan Wang  <n_wang@apple.com>
    225
  • trunk/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp

    r200775 r204063  
    7171}
    7272
    73 JSValue JSHTMLOptionsCollection::remove(ExecState& state)
    74 {
    75     // The argument can be an HTMLOptionElement or an index.
    76     JSValue argument = state.argument(0);
    77     if (HTMLOptionElement* option = JSHTMLOptionElement::toWrapped(argument))
    78         wrapped().remove(*option);
    79     else
    80         wrapped().remove(argument.toInt32(&state));
    81     return jsUndefined();
    8273}
    83 
    84 }
  • trunk/Source/WebCore/html/HTMLOptionsCollection.idl

    r204028 r204063  
    4343    [RaisesException] void add(HTMLOptionElement option, unsigned long index);
    4444#endif
    45     [Custom] void remove(optional unsigned long index);
     45
     46    void remove(long index);
     47#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
     48    // FIXME: This overload is not in the specification and has been dropped in Blink.
     49    void remove(HTMLOptionElement option);
     50#endif
    4651
    4752#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
Note: See TracChangeset for help on using the changeset viewer.