Title: [292887] trunk/Source/WebCore
- Revision
- 292887
- Author
- [email protected]
- Date
- 2022-04-14 13:35:15 -0700 (Thu, 14 Apr 2022)
Log Message
Require an existing AtomString for HTMLFormElement's named getter parameter
https://bugs.webkit.org/show_bug.cgi?id=239335
Reviewed by Darin Adler.
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.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::namedElements):
* html/HTMLFormElement.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292886 => 292887)
--- trunk/Source/WebCore/ChangeLog 2022-04-14 20:19:14 UTC (rev 292886)
+++ trunk/Source/WebCore/ChangeLog 2022-04-14 20:35:15 UTC (rev 292887)
@@ -1,5 +1,20 @@
2022-04-14 Chris Dumez <[email protected]>
+ Require an existing AtomString for HTMLFormElement's named getter parameter
+ https://bugs.webkit.org/show_bug.cgi?id=239335
+
+ Reviewed by Darin Adler.
+
+ 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.
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::namedElements):
+ * html/HTMLFormElement.idl:
+
+2022-04-14 Chris Dumez <[email protected]>
+
Require an existing AtomString for HTMLDocument's named getter parameter
https://bugs.webkit.org/show_bug.cgi?id=239334
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (292886 => 292887)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2022-04-14 20:19:14 UTC (rev 292886)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2022-04-14 20:35:15 UTC (rev 292887)
@@ -932,6 +932,9 @@
// FIXME: Use Ref<HTMLElement> for the function result since there are no non-HTML elements returned here.
Vector<Ref<Element>> HTMLFormElement::namedElements(const AtomString& name)
{
+ if (name.isEmpty())
+ return { };
+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#dom-form-nameditem
Vector<Ref<Element>> namedItems = elements()->namedItems(name);
Modified: trunk/Source/WebCore/html/HTMLFormElement.idl (292886 => 292887)
--- trunk/Source/WebCore/html/HTMLFormElement.idl 2022-04-14 20:19:14 UTC (rev 292886)
+++ trunk/Source/WebCore/html/HTMLFormElement.idl 2022-04-14 20:35:15 UTC (rev 292887)
@@ -39,7 +39,7 @@
readonly attribute HTMLFormControlsCollection elements;
readonly attribute unsigned long length;
getter Element? (unsigned long index);
- getter (RadioNodeList or Element)? ([AtomString] DOMString name);
+ getter (RadioNodeList or Element)? ([RequiresExistingAtomString] DOMString name);
[ImplementedAs=submitFromJavaScript] undefined submit();
[EnabledBySetting=RequestSubmitEnabled] undefined requestSubmit(optional HTMLElement? submitter);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes