mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Make root_from_handle_value
a safe function by accepting SafeJSContext
(#39193)
Change from unsafe pointer of root_from_handle_value to SafeJSContext. #39131 --------- Signed-off-by: JasonHonKL <j2004nol@gmail.com> Signed-off-by: Jason <jason@198-61-252-113-on-nets.com> Signed-off-by: Josh Matthews <josh@joshmatthews.net> Co-authored-by: Jason <jason@198-61-252-113-on-nets.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
721fc01c30
commit
839878c743
4 changed files with 48 additions and 51 deletions
|
@ -342,7 +342,7 @@ impl TrustedTypePolicyFactory {
|
|||
cx: JSContext,
|
||||
value: HandleValue,
|
||||
) -> Result<DomRoot<TrustedScript>, ()> {
|
||||
unsafe { root_from_handlevalue::<TrustedScript>(value, *cx) }
|
||||
root_from_handlevalue::<TrustedScript>(value, cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ impl TrustedTypePolicyFactoryMethods<crate::DomTypeHolder> for TrustedTypePolicy
|
|||
/// <https://www.w3.org/TR/trusted-types/#dom-trustedtypepolicyfactory-ishtml>
|
||||
#[allow(unsafe_code)]
|
||||
fn IsHTML(&self, cx: JSContext, value: HandleValue) -> bool {
|
||||
unsafe { root_from_handlevalue::<TrustedHTML>(value, *cx).is_ok() }
|
||||
root_from_handlevalue::<TrustedHTML>(value, cx).is_ok()
|
||||
}
|
||||
/// <https://www.w3.org/TR/trusted-types/#dom-trustedtypepolicyfactory-isscript>
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -369,7 +369,7 @@ impl TrustedTypePolicyFactoryMethods<crate::DomTypeHolder> for TrustedTypePolicy
|
|||
/// <https://www.w3.org/TR/trusted-types/#dom-trustedtypepolicyfactory-isscripturl>
|
||||
#[allow(unsafe_code)]
|
||||
fn IsScriptURL(&self, cx: JSContext, value: HandleValue) -> bool {
|
||||
unsafe { root_from_handlevalue::<TrustedScriptURL>(value, *cx).is_ok() }
|
||||
root_from_handlevalue::<TrustedScriptURL>(value, cx).is_ok()
|
||||
}
|
||||
/// <https://www.w3.org/TR/trusted-types/#dom-trustedtypepolicyfactory-emptyhtml>
|
||||
fn EmptyHTML(&self, can_gc: CanGc) -> DomRoot<TrustedHTML> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue