[Webkit-unassigned] [Bug 110612] Enumerating an HTMLCollection needs to enumerate the named properties
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Feb 28 17:08:30 PST 2013
https://bugs.webkit.org/show_bug.cgi?id=110612
--- Comment #5 from Ryosuke Niwa <rniwa at webkit.org> 2013-02-28 17:10:54 PST ---
(From update of attachment 190847)
View in context: https://bugs.webkit.org/attachment.cgi?id=190847&action=review
> Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp:104
> + Vector<String> propertyNameStrings;
> + for (unsigned index = 0; index < collection->length(); ++index) {
> + String attributeValue = toElement(collection->item(index))->getAttribute(HTMLNames::nameAttr);
> + if (!attributeValue.isEmpty() && !propertyNameStrings.contains(attributeValue))
> + propertyNameStrings.append(attributeValue);
> +
> + attributeValue = toElement(collection->item(index))->getIdAttribute();
> + if (!attributeValue.isEmpty() && !propertyNameStrings.contains(attributeValue))
> + propertyNameStrings.append(attributeValue);
> + }
We shouldn't be iterating through nodes like this if we already have a cache (m_idCache and m_nameCache).
If needed, we should modify the cache structure of HTMLCollection to satisfy this use case.
> LayoutTests/fast/dom/htmlcollection-enumeration.html:25
> +shouldBeTrue("'0' in document.forms");
> +shouldBeTrue("'1' in document.forms");
> +shouldBeTrue("'2' in document.forms");
> +shouldBeTrue("'name1' in document.forms");
> +shouldBeTrue("'id1' in document.forms");
> +shouldBeTrue("'id2' in document.forms");
> +shouldBeTrue("'name2' in document.forms");
> +shouldBeTrue("'id3' in document.forms");
> +shouldBeTrue("'id4' in document.forms");
> +shouldBeTrue("'length' in document.forms");
> +shouldBeTrue("'item' in document.forms");
> +shouldBeTrue("'namedItem' in document.forms");
Please make sure to test other subclasses of HTMLCollection like HTMLAllCollection, HTMLPropertiesCollection, etc...
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list