Implement Trusted Types for ShadowRoot (#38595)

Also make TrustedHTML work the same as TrustedScript by
only taking 1 `&str` to make things easier.

Part of #36258

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe 2025-08-11 15:39:55 +02:00 committed by GitHub
parent abc549eff7
commit 3976fa77bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 38 additions and 52 deletions

View file

@ -43,18 +43,16 @@ impl TrustedHTML {
pub(crate) fn get_trusted_script_compliant_string(
global: &GlobalScope,
value: TrustedHTMLOrString,
containing_class: &str,
field: &str,
sink: &str,
can_gc: CanGc,
) -> Fallible<DOMString> {
match value {
TrustedHTMLOrString::String(value) => {
let sink = format!("{} {}", containing_class, field);
TrustedTypePolicyFactory::get_trusted_type_compliant_string(
TrustedType::TrustedHTML,
global,
value,
&sink,
sink,
"'script'",
can_gc,
)