Changeset 154012 in webkit


Ignore:
Timestamp:
Aug 13, 2013 10:58:53 AM (11 years ago)
Author:
Christophe Dumez
Message:

NodeList.item() does not behave according to specification
https://bugs.webkit.org/show_bug.cgi?id=119722

Reviewed by Darin Adler.

Source/WebCore:

Make NodeList.item() indexed getter behave according to specification:
http://dom.spec.whatwg.org/#nodelist

Namely, we no longer throw if the index is negative (meaning the
[IsIndex] extended attribute is dropped) and the argument is now
mandatory.

This behavior is consistent with both IE10 and Firefox and since
recently Blink.

Test: fast/dom/nodelist-item-parameter.html

  • dom/NodeList.idl:

LayoutTests:

Add a layout test to check that the NodeList.item() indexed getter's
argument is properly validated. Also, update the following test case now
that the argument is mandatory:
fast/dom/non-numeric-values-numeric-parameters.html

  • fast/dom/nodelist-item-parameter-expected.txt: Added.
  • fast/dom/nodelist-item-parameter.html: Added.
  • fast/dom/non-numeric-values-numeric-parameters-expected.txt:
  • fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154009 r154012  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        NodeList.item() does not behave according to specification
     4        https://bugs.webkit.org/show_bug.cgi?id=119722
     5
     6        Reviewed by Darin Adler.
     7
     8        Add a layout test to check that the NodeList.item() indexed getter's
     9        argument is properly validated. Also, update the following test case now
     10        that the argument is mandatory:
     11        fast/dom/non-numeric-values-numeric-parameters.html
     12
     13        * fast/dom/nodelist-item-parameter-expected.txt: Added.
     14        * fast/dom/nodelist-item-parameter.html: Added.
     15        * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
     16        * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
     17
    1182013-08-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    219
  • trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt

    r154005 r154012  
    5151PASS nonNumericPolicy('document.body.attributes.item(x)') is 'any type allowed'
    5252PASS nonNumericPolicy('document.createNodeIterator(document, x, null, false)') is 'any type allowed'
    53 PASS nonNumericPolicy('document.getElementsByTagName("div").item(x)') is 'any type allowed'
     53PASS nonNumericPolicy('document.getElementsByTagName("div").item(x)') is 'any type allowed (but not omitted)'
    5454PASS nonNumericPolicy('document.createRange().setStart(document, x)') is 'any type allowed'
    5555PASS nonNumericPolicy('document.createRange().setEnd(document, x)') is 'any type allowed'
  • trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js

    r154005 r154012  
    300300// NodeList
    301301
    302 shouldBe("nonNumericPolicy('document.getElementsByTagName(\"div\").item(x)')", "'any type allowed'");
     302shouldBe("nonNumericPolicy('document.getElementsByTagName(\"div\").item(x)')", "'any type allowed (but not omitted)'");
    303303
    304304// Range
  • trunk/Source/WebCore/ChangeLog

    r154010 r154012  
     12013-08-13  Christophe Dumez  <ch.dumez@sisa.samsung.com>
     2
     3        NodeList.item() does not behave according to specification
     4        https://bugs.webkit.org/show_bug.cgi?id=119722
     5
     6        Reviewed by Darin Adler.
     7
     8        Make NodeList.item() indexed getter behave according to specification:
     9        http://dom.spec.whatwg.org/#nodelist
     10
     11        Namely, we no longer throw if the index is negative (meaning the
     12        [IsIndex] extended attribute is dropped) and the argument is now
     13        mandatory.
     14
     15        This behavior is consistent with both IE10 and Firefox and since
     16        recently Blink.
     17
     18        Test: fast/dom/nodelist-item-parameter.html
     19
     20        * dom/NodeList.idl:
     21
    1222013-08-13  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebCore/dom/NodeList.idl

    r151499 r154012  
    2424] interface NodeList {
    2525
    26     getter Node item([IsIndex,Default=Undefined] optional unsigned long index);
     26    getter Node item(unsigned long index);
    2727    getter (Node or unsigned long) (DOMString name);
    2828
Note: See TracChangeset for help on using the changeset viewer.