DOMHTMLCollection::item may return a wrong element after namedItem is called
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2012 06:38:42 +0000 (06:38 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2012 06:38:42 +0000 (06:38 +0000)
commit73a06dfacf0ee6bc676418ba8fd8c55e66e3749e
tree11e7fa4e01065c6e9f6bb89ddce159815217a228
parent80150af787a4d0f2b0017d76973c2e4b5e3c7a56
DOMHTMLCollection::item may return a wrong element after namedItem is called
https://bugs.webkit.org/show_bug.cgi?id=90240

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by namedItem updating m_cache.current without updating m_cache.position.
Fixed the bug by updating both. This is similar to the bug I fixed in r121478.

WebKit API Test: WebKit1.HTMLCollectionNamedItemTest

* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::namedItem):

Tools:

Add a WebKit API test since namedItem is not used in the JS/V8 binding code.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.html: Copied from Tools/TestWebKitAPI/Tests/mac/HTMLFormCollectionNamedItem.html.
* TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.mm: Copied from Tools/TestWebKitAPI/Tests/mac/HTMLFormCollectionNamedItem.mm.
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLCollection.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.html [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.mm [new file with mode: 0644]