Bug 239335 - Require an existing AtomString for HTMLFormElement's named getter parameter
Summary: Require an existing AtomString for HTMLFormElement's named getter parameter
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-14 08:12 PDT by Chris Dumez
Modified: 2022-04-14 13:37 PDT (History)
11 users (show)

See Also:


Attachments
Patch (2.47 KB, patch)
2022-04-14 08:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2022-04-14 08:12:23 PDT
Require an existing AtomString for HTMLFormElement's named getter parameter. There is no point in allocating a new AtomString as the AtomString should already exist if there is any element with this name / id.
Comment 1 Chris Dumez 2022-04-14 08:13:47 PDT
Created attachment 457630 [details]
Patch
Comment 2 Darin Adler 2022-04-14 13:01:09 PDT
Comment on attachment 457630 [details]
Patch

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

> Source/WebCore/html/HTMLFormElement.cpp:936
> +    if (name.isEmpty())
> +        return { };

This further optimizes the null and empty string cases, but slows down all the non-empty cases. I don’t think it’s needed for correctness, unless I missed something. I suppose it’s a good idea.

> Source/WebCore/html/HTMLFormElement.idl:42
> +    getter (RadioNodeList or Element)? ([RequiresExistingAtomString] DOMString name);

Want to be sure these are good optimizations. I think I made RequiresExistingAtomString, and it’s obviously helpful if people often look for something that doesn’t exist, but it might *slightly* slow down the case of looking for things that do exist.
Comment 3 EWS 2022-04-14 13:36:25 PDT
Committed r292887 (249657@main): <https://commits.webkit.org/249657@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 457630 [details].
Comment 4 Radar WebKit Bug Importer 2022-04-14 13:37:14 PDT
<rdar://problem/91774265>