Changeset 204034 in webkit


Ignore:
Timestamp:
Aug 2, 2016, 12:13:42 PM (9 years ago)
Author:
Chris Dumez
Message:

HTMLCollection's named getter should only do 'name' attribute matching for HTMLElements
https://bugs.webkit.org/show_bug.cgi?id=160456

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:

Rebaseline. We are still failing but on the next check.

  • web-platform-tests/dom/nodes/Element-children-expected.txt:

Rebaseline now that one more check is passing.

Source/WebCore:

HTMLCollection's named getter should only do 'name' attribute matching for HTMLElements:

Our slow path which relies on HTMLCollection::updateNamedElementCache() does the right
thing. However, we have a fast path in
CachedHTMLCollection<HTMLCollectionClass, traversalType>::namedItem() that was missing a
check.

Firefox and Chrome both behave correctly here.

No new tests, rebaselined existing tests.

  • html/CachedHTMLCollection.h:

(WebCore::traversalType>::namedItem):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r204023 r204034  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLCollection's named getter should only do 'name' attribute matching for HTMLElements
     4        https://bugs.webkit.org/show_bug.cgi?id=160456
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:
     9        Rebaseline. We are still failing but on the next check.
     10
     11        * web-platform-tests/dom/nodes/Element-children-expected.txt:
     12        Rebaseline now that one more check is passing.
     13
    1142016-08-02  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt

    r200309 r204034  
    99PASS Should be able to set expando shadowing a proto prop (item)
    1010PASS Should be able to set expando shadowing a proto prop (namedItem)
    11 FAIL hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames assert_false: expected false got true
     11FAIL hasOwnProperty, getOwnPropertyDescriptor, getOwnPropertyNames assert_true: desc.configurable expected true got false
    1212PASS HTML element with uppercase tagName never matches in HTML Documents
    1313PASS Element in non-HTML namespace, no prefix, lowercase name
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-children-expected.txt

    r196423 r204034  
    22
    33PASS HTMLCollection edge cases
    4 FAIL HTMLCollection edge cases 1 assert_false: expected false got true
     4PASS HTMLCollection edge cases 1
    55
  • trunk/Source/WebCore/ChangeLog

    r204033 r204034  
     12016-08-02  Chris Dumez  <cdumez@apple.com>
     2
     3        HTMLCollection's named getter should only do 'name' attribute matching for HTMLElements
     4        https://bugs.webkit.org/show_bug.cgi?id=160456
     5
     6        Reviewed by Darin Adler.
     7
     8        HTMLCollection's named getter should only do 'name' attribute matching for HTMLElements:
     9        - https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem
     10
     11        Our slow path which relies on HTMLCollection::updateNamedElementCache() does the right
     12        thing. However, we have a fast path in
     13        CachedHTMLCollection<HTMLCollectionClass, traversalType>::namedItem() that was missing a
     14        check.
     15
     16        Firefox and Chrome both behave correctly here.
     17
     18        No new tests, rebaselined existing tests.
     19
     20        * html/CachedHTMLCollection.h:
     21        (WebCore::traversalType>::namedItem):
     22
    1232016-08-02  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebCore/html/CachedHTMLCollection.h

    r197566 r204034  
    137137        } else if (treeScope.hasElementWithName(*name.impl())) {
    138138            if (!treeScope.containsMultipleElementsWithName(name)) {
    139                 candidate = treeScope.getElementByName(name);
    140                 if (candidate && type() == DocAll && !nameShouldBeVisibleInDocumentAll(*candidate))
    141                     candidate = nullptr;
     139                if ((candidate = treeScope.getElementByName(name))) {
     140                    if (!is<HTMLElement>(*candidate))
     141                        candidate = nullptr;
     142                    else if (type() == DocAll && !nameShouldBeVisibleInDocumentAll(*candidate))
     143                        candidate = nullptr;
     144                }
    142145            }
    143146        } else
Note: See TracChangeset for help on using the changeset viewer.