mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-09 02:21:53 +00:00
LibWeb: Iterate safely in HTMLSelectElement::set_value()
We can't iterate over m_cached_list_of_options and call set_selected() in the loop, since that may end up rebuilding m_cached_list_of_options, disrupting iteration.
This commit is contained in:
parent
18d17385fb
commit
5c5283492b
Notes:
github-actions[bot]
2025-05-29 01:48:10 +00:00
Author: https://github.com/awesomekling
Commit: 5c5283492b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4899
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/shannonbooth
1 changed files with 1 additions and 1 deletions
|
@ -377,7 +377,7 @@ String HTMLSelectElement::value() const
|
|||
WebIDL::ExceptionOr<void> HTMLSelectElement::set_value(String const& value)
|
||||
{
|
||||
update_cached_list_of_options();
|
||||
for (auto const& option_element : m_cached_list_of_options)
|
||||
for (auto const& option_element : list_of_options())
|
||||
option_element->set_selected(option_element->value() == value);
|
||||
update_inner_text_element();
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue