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