Bug 120432

Summary: REGRESSION(r154586): Past names map should only be used when named item is empty
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, darin, kling, koivisto, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 120277, 120328    
Bug Blocks:    
Attachments:
Description Flags
Fixes the bug andersca: review+

Description Ryosuke Niwa 2013-08-28 11:39:22 PDT
When we found any form associated element or associated image elements for a given name, we should not be using the past names map.
i.e. the past names map should only be used if there are not elements matching the name.

This accidentally regressed in http://trac.webkit.org/changeset/154586 because the old code behaved correctly when getNamedElements were called in pairs.
Comment 1 Ryosuke Niwa 2013-08-28 11:56:13 PDT
Created attachment 209913 [details]
Fixes the bug
Comment 2 Anders Carlsson 2013-08-28 11:57:23 PDT
Comment on attachment 209913 [details]
Fixes the bug

View in context: https://bugs.webkit.org/attachment.cgi?id=209913&action=review

> Source/WebCore/html/HTMLFormElement.cpp:684
> +    else if (elementFromPast && !namedItems.size())

Please use namedItems.isEmpty() instead.
Comment 3 Ryosuke Niwa 2013-08-28 11:58:50 PDT
Committed r154765: <http://trac.webkit.org/changeset/154765>