mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02: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:
committed by
Alexander Kalenik
parent
18d17385fb
commit
5c5283492b
Notes:
github-actions[bot]
2025-05-29 01:48:10 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/5c5283492bb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4899 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/shannonbooth
@@ -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 {};
|
||||
|
||||
Reference in New Issue
Block a user