Bug 74806 - JSC/HTMLCollection: Optimize canGetItemsForName().
Summary: JSC/HTMLCollection: Optimize canGetItemsForName().
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-18 00:07 PST by Andreas Kling
Modified: 2011-12-18 18:06 PST (History)
1 user (show)

See Also:


Attachments
Patch (4.03 KB, patch)
2011-12-18 00:12 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.