Use DOMString for internal data of Trusted Types (#37472)

This avoids various conversions back and forth between DOMString and
String. By using DOMString consistently, we avoid these
double-conversions. The only caveat are the USVString which are
initially passed into
TrustedScriptURL.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe 2025-06-15 16:12:33 +02:00 committed by GitHub
parent dfbd5b7d21
commit 576c7445b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 72 additions and 70 deletions

View file

@ -622,7 +622,11 @@ impl HTMLIFrameElementMethods<crate::DomTypeHolder> for HTMLIFrameElement {
can_gc,
)?;
// Step 2: Set an attribute value given this, srcdoc's local name, and compliantString.
element.set_attribute(local_name, AttrValue::String(value), can_gc);
element.set_attribute(
local_name,
AttrValue::String(value.as_ref().to_owned()),
can_gc,
);
Ok(())
}