LibWeb: Avoid invoking Trusted Types where avoidable

Prevents observably calling Trusted Types, which can run arbitrary JS,
cause crashes due to use of MUST and allow arbitrary JS to modify
internal elements.
This commit is contained in:
Luke Wilde 2025-10-31 12:30:47 +00:00 committed by Tim Flynn
parent fb9406ddcd
commit 82bd3d3891
Notes: github-actions[bot] 2025-11-06 16:46:00 +00:00
83 changed files with 407 additions and 366 deletions

View file

@ -258,7 +258,7 @@ void DOMTokenList::set_value(String const& value)
if (!associated_element)
return;
MUST(associated_element->set_attribute(m_associated_attribute, value));
associated_element->set_attribute_value(m_associated_attribute, value);
}
WebIDL::ExceptionOr<void> DOMTokenList::validate_token(StringView token) const
@ -294,7 +294,7 @@ void DOMTokenList::run_update_steps()
return;
// 2. Set an attribute value for the associated element using associated attributes local name and the result of running the ordered set serializer for token set.
MUST(associated_element->set_attribute(m_associated_attribute, serialize_ordered_set()));
associated_element->set_attribute_value(m_associated_attribute, serialize_ordered_set());
}
Optional<JS::Value> DOMTokenList::item_value(size_t index) const