mirror of
https://github.com/servo/servo
synced 2026-04-26 09:35:26 +02:00
script: Pass &mut JSContext to TrustedScriptURL::get_trusted_type_compliant_string (#43245)
Also rename the method and consolidate the sink to be consistent with both `TrustedHTML` and `TrustedScript` Part of #42638 Testing: It compiles Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
committed by
GitHub
parent
048612fe84
commit
b6ba612a54
@@ -1289,20 +1289,19 @@ impl HTMLScriptElementMethods<crate::DomTypeHolder> for HTMLScriptElement {
|
||||
}
|
||||
|
||||
/// <https://w3c.github.io/trusted-types/dist/spec/#the-src-idl-attribute>
|
||||
fn SetSrc(&self, value: TrustedScriptURLOrUSVString, can_gc: CanGc) -> Fallible<()> {
|
||||
fn SetSrc(&self, cx: &mut JSContext, value: TrustedScriptURLOrUSVString) -> Fallible<()> {
|
||||
let element = self.upcast::<Element>();
|
||||
let local_name = &local_name!("src");
|
||||
let value = TrustedScriptURL::get_trusted_script_url_compliant_string(
|
||||
let value = TrustedScriptURL::get_trusted_type_compliant_string(
|
||||
cx,
|
||||
&element.owner_global(),
|
||||
value,
|
||||
"HTMLScriptElement",
|
||||
local_name,
|
||||
can_gc,
|
||||
&format!("HTMLScriptElement {}", local_name),
|
||||
)?;
|
||||
element.set_attribute(
|
||||
local_name,
|
||||
AttrValue::String(value.str().to_owned()),
|
||||
can_gc,
|
||||
CanGc::from_cx(cx),
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user