Changeset 204115 in webkit


Ignore:
Timestamp:
Aug 3, 2016, 10:26:58 PM (9 years ago)
Author:
Chris Dumez
Message:

Object.getOwnPropertyNames() on NamedNodeMap fails to return named properties
https://bugs.webkit.org/show_bug.cgi?id=160517

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more checks are passing.

  • web-platform-tests/dom/collections/namednodemap-supported-property-names-expected.txt:
  • web-platform-tests/dom/nodes/attributes-expected.txt:

Source/WebCore:

Object.getOwnPropertyNames() on NamedNodeMap should return named
properties' names as per:

No new tests, rebaselined existing tests.

  • dom/NamedNodeMap.cpp:

(WebCore::NamedNodeMap::supportedPropertyNames):

  • dom/NamedNodeMap.h:
Location:
trunk
Files:
6 edited

Legend:

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

    r204114 r204115  
     12016-08-03  Chris Dumez  <cdumez@apple.com>
     2
     3        Object.getOwnPropertyNames() on NamedNodeMap fails to return named properties
     4        https://bugs.webkit.org/show_bug.cgi?id=160517
     5
     6        Reviewed by Alex Christensen.
     7
     8        Rebaseline several W3C tests now that more checks are passing.
     9
     10        * web-platform-tests/dom/collections/namednodemap-supported-property-names-expected.txt:
     11        * web-platform-tests/dom/nodes/attributes-expected.txt:
     12
    1132016-08-03  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/collections/namednodemap-supported-property-names-expected.txt

    r204090 r204115  
    11
    2 FAIL Object.getOwnPropertyNames on NamedNodeMap assert_array_equals: lengths differ, expected 4 got 2
    3 FAIL Object.getOwnPropertyNames on NamedNodeMap of input assert_array_equals: lengths differ, expected 8 got 4
    4 FAIL Object.getOwnPropertyNames on NamedNodeMap after attribute removal assert_array_equals: lengths differ, expected 6 got 3
     2PASS Object.getOwnPropertyNames on NamedNodeMap
     3PASS Object.getOwnPropertyNames on NamedNodeMap of input
     4PASS Object.getOwnPropertyNames on NamedNodeMap after attribute removal
    55Simple
    66
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/attributes-expected.txt

    r203852 r204115  
    5050PASS setAttributeNode called with an Attr that has the same name as an existing one should not change attribute order
    5151PASS getAttributeNames tests
    52 FAIL Own property correctness with basic attributes assert_array_equals: lengths differ, expected 4 got 2
    53 FAIL Own property correctness with non-namespaced attribute before same-name namespaced one assert_array_equals: lengths differ, expected 5 got 3
    54 FAIL Own property correctness with namespaced attribute before same-name non-namespaced one assert_array_equals: lengths differ, expected 5 got 3
    55 FAIL Own property correctness with two namespaced attributes with the same name-with-prefix assert_array_equals: lengths differ, expected 5 got 3
    56 FAIL Own property names should only include all-lowercase qualified names for an HTML element in an HTML document assert_array_equals: lengths differ, expected 8 got 6
    57 FAIL Own property names should include all qualified names for a non-HTML element in an HTML document assert_array_equals: lengths differ, expected 12 got 6
    58 FAIL Own property names should include all qualified names for an HTML element in a non-HTML document assert_array_equals: lengths differ, expected 12 got 6
     52PASS Own property correctness with basic attributes
     53PASS Own property correctness with non-namespaced attribute before same-name namespaced one
     54PASS Own property correctness with namespaced attribute before same-name non-namespaced one
     55PASS Own property correctness with two namespaced attributes with the same name-with-prefix
     56PASS Own property names should only include all-lowercase qualified names for an HTML element in an HTML document
     57PASS Own property names should include all qualified names for a non-HTML element in an HTML document
     58PASS Own property names should include all qualified names for an HTML element in a non-HTML document
    5959
  • trunk/Source/WebCore/ChangeLog

    r204114 r204115  
     12016-08-03  Chris Dumez  <cdumez@apple.com>
     2
     3        Object.getOwnPropertyNames() on NamedNodeMap fails to return named properties
     4        https://bugs.webkit.org/show_bug.cgi?id=160517
     5
     6        Reviewed by Alex Christensen.
     7
     8        Object.getOwnPropertyNames() on NamedNodeMap should return named
     9        properties' names as per:
     10        - https://dom.spec.whatwg.org/#dom-namednodemap-item
     11
     12        No new tests, rebaselined existing tests.
     13
     14        * dom/NamedNodeMap.cpp:
     15        (WebCore::NamedNodeMap::supportedPropertyNames):
     16        * dom/NamedNodeMap.h:
     17
    1182016-08-03  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebCore/dom/NamedNodeMap.cpp

    r203731 r204115  
    2929#include "Element.h"
    3030#include "ExceptionCode.h"
     31#include "HTMLDocument.h"
     32#include "HTMLElement.h"
    3133
    3234namespace WebCore {
     
    6466}
    6567
    66 Vector<AtomicString> NamedNodeMap::supportedPropertyNames()
     68Vector<String> NamedNodeMap::supportedPropertyNames()
    6769{
    68     // FIXME: Should be implemented.
    69     return Vector<AtomicString>();
     70    Vector<String> names = m_element.getAttributeNames();
     71    if (is<HTMLElement>(m_element) && is<HTMLDocument>(m_element.document())) {
     72        names.removeAllMatching([](String& name) {
     73            return name.convertToASCIILowercase() != name;
     74        });
     75    }
     76    return names;
    7077}
    7178
  • trunk/Source/WebCore/dom/NamedNodeMap.h

    r203731 r204115  
    5454    RefPtr<Attr> getNamedItem(const AtomicString&) const;
    5555    RefPtr<Attr> removeNamedItem(const AtomicString& name, ExceptionCode&);
    56     Vector<AtomicString> supportedPropertyNames();
     56    Vector<String> supportedPropertyNames();
    5757
    5858    RefPtr<Attr> getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
Note: See TracChangeset for help on using the changeset viewer.