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

@ -446,17 +446,17 @@ String HTMLHyperlinkElementUtils::href() const
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
WebIDL::ExceptionOr<void> HTMLHyperlinkElementUtils::set_href(String href)
void HTMLHyperlinkElementUtils::set_href(String href)
{
// The href attribute's setter must set this element's href content attribute's value to the given value.
return set_hyperlink_element_utils_href(move(href));
set_hyperlink_element_utils_href(move(href));
}
// https://html.spec.whatwg.org/multipage/links.html#update-href
void HTMLHyperlinkElementUtils::update_href()
{
// To update href, set the element's href content attribute's value to the element's url, serialized.
MUST(set_hyperlink_element_utils_href(m_url->serialize()));
set_hyperlink_element_utils_href(m_url->serialize());
}
bool HTMLHyperlinkElementUtils::cannot_navigate() const