Bug 74806

Summary: JSC/HTMLCollection: Optimize canGetItemsForName().
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Andreas Kling 2011-12-18 00:07:51 PST
The JSC bindings for HTMLCollection and HTMLAllCollection canGetItemsFormName() currently retrieve the entire list of relevant named just to see if it's empty. We could accomplish the same thing in a more efficient way.
Comment 1 Andreas Kling 2011-12-18 00:12:43 PST
Created attachment 119755 [details]
Patch
Comment 2 Andreas Kling 2011-12-18 14:21:15 PST
Comment on attachment 119755 [details]
Patch

Clearing flags on attachment: 119755

Committed r103190: <http://trac.webkit.org/changeset/103190>
Comment 3 Andreas Kling 2011-12-18 14:21:26 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2011-12-18 17:57:04 PST
Comment on attachment 119755 [details]
Patch

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

> Source/WebCore/html/HTMLCollection.cpp:339
> +    resetCollectionInfo();

The need to call this is a surprise. Why is it needed?
Comment 5 Andreas Kling 2011-12-18 18:04:23 PST
Comment on attachment 119755 [details]
Patch

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

>> Source/WebCore/html/HTMLCollection.cpp:339
>> +    resetCollectionInfo();
> 
> The need to call this is a surprise. Why is it needed?

resetCollectionInfo() is poorly named, it doesn't actually reset anything unless the document's DOM tree version has changed.
If we don't call this, updateNameCache() may find that m_info->hasNameCache is true, yet the cache is out of sync with the document.
Comment 6 Darin Adler 2011-12-18 18:06:12 PST
(In reply to comment #5)
> resetCollectionInfo() is poorly named

OK. It’s kind of fun for me how we all continually learn together how important names are for future understanding of the code.