aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorBarigbue Nbira <barigbuenbira@gmail.com>2025-04-08 19:39:47 +0100
committerGitHub <noreply@github.com>2025-04-08 18:39:47 +0000
commit7fd004adcee67ddf0b34b6d00f179c216461ac90 (patch)
tree5b86a0cf9f2135fa74144eac9515537cdfbb07c4 /components
parent867711c6b9da3168f9803c5678093ff7a3a74a2f (diff)
downloadservo-7fd004adcee67ddf0b34b6d00f179c216461ac90.tar.gz
servo-7fd004adcee67ddf0b34b6d00f179c216461ac90.zip
Remove unsafe annotation add to unsafe blocks (#36399)
Remove the `unsafe` annotation from the `cross_origin_get` function and add `unsafe` blocks around unsafe code within the function Testing: Testing is not required as this change does not alter behaviour. Fixes: #36358 --------- Signed-off-by: Barigbue <barigbuenbira@gmail.com>
Diffstat (limited to 'components')
-rw-r--r--components/script_bindings/proxyhandler.rs40
1 files changed, 23 insertions, 17 deletions
diff --git a/components/script_bindings/proxyhandler.rs b/components/script_bindings/proxyhandler.rs
index beafaaed8bf..314d1369048 100644
--- a/components/script_bindings/proxyhandler.rs
+++ b/components/script_bindings/proxyhandler.rs
@@ -606,7 +606,7 @@ pub(crate) fn maybe_cross_origin_get_prototype<D: DomTypes>(
/// for a maybe-cross-origin object.
///
/// [`CrossOriginGet`]: https://html.spec.whatwg.org/multipage/#crossoriginget-(-o,-p,-receiver-)
-pub(crate) unsafe fn cross_origin_get<D: DomTypes>(
+pub(crate) fn cross_origin_get<D: DomTypes>(
cx: SafeJSContext,
proxy: RawHandleObject,
receiver: RawHandleValue,
@@ -616,14 +616,16 @@ pub(crate) unsafe fn cross_origin_get<D: DomTypes>(
// > 1. Let `desc` be `? O.[[GetOwnProperty]](P)`.
rooted!(in(*cx) let mut descriptor = PropertyDescriptor::default());
let mut is_none = false;
- if !InvokeGetOwnPropertyDescriptor(
- GetProxyHandler(*proxy),
- *cx,
- proxy,
- id,
- descriptor.handle_mut().into(),
- &mut is_none,
- ) {
+ if !unsafe {
+ InvokeGetOwnPropertyDescriptor(
+ GetProxyHandler(*proxy),
+ *cx,
+ proxy,
+ id,
+ descriptor.handle_mut().into(),
+ &mut is_none,
+ )
+ } {
return false;
}
@@ -654,16 +656,20 @@ pub(crate) unsafe fn cross_origin_get<D: DomTypes>(
}
rooted!(in(*cx) let mut getter_jsval = UndefinedValue());
- getter.get().to_jsval(*cx, getter_jsval.handle_mut());
+ unsafe {
+ getter.get().to_jsval(*cx, getter_jsval.handle_mut());
+ }
// > 7. Return `? Call(getter, Receiver)`.
- jsapi::Call(
- *cx,
- receiver,
- getter_jsval.handle().into(),
- &jsapi::HandleValueArray::empty(),
- vp,
- )
+ unsafe {
+ jsapi::Call(
+ *cx,
+ receiver,
+ getter_jsval.handle().into(),
+ &jsapi::HandleValueArray::empty(),
+ vp,
+ )
+ }
}
/// Implementation of [`CrossOriginSet`].