mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Iterate over a copy of associated form controls in form.reset()
DOM structure may change during reset algorithm invocation, which may lead to form controls being unregistered.
This commit is contained in:
parent
34a8f51eb8
commit
a0b44ff5e7
|
|
@ -317,7 +317,8 @@ void HTMLFormElement::reset_form()
|
|||
|
||||
// 2. If reset is true, then invoke the reset algorithm of each resettable element whose form owner is form.
|
||||
if (reset) {
|
||||
for (auto element : m_associated_elements) {
|
||||
GC::RootVector<GC::Ref<HTMLElement>> associated_elements_copy(heap(), m_associated_elements);
|
||||
for (auto element : associated_elements_copy) {
|
||||
VERIFY(is<FormAssociatedElement>(*element));
|
||||
auto& form_associated_element = dynamic_cast<FormAssociatedElement&>(*element);
|
||||
if (form_associated_element.is_resettable())
|
||||
|
|
|
|||
4
Tests/LibWeb/Crash/HTML/reset-form-iteration.html
Normal file
4
Tests/LibWeb/Crash/HTML/reset-form-iteration.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<form id="theForm"><output><input></output></form>
|
||||
<script>
|
||||
theForm.reset();
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user