mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Wrap unsafe code in components/script/bindings
in unsafe {}
(#38544)
Clippy now checks to see if unsafe code is wrapped in unsafe blocks. We have this lint disabled for `script` and `script_bindings` because of a lot of legacy code that doesn't do this. The lint is useful though as it makes it more obvious what code is unsafe. This is an incremental step toward being able to turn this lint on for `script`. This has the benefit of silencing warnings that show up in some IDEs that use rust-analyzer. Testing: This should not change behavior at all and is thus covered by existing tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
fef104cff7
commit
931025c16e
13 changed files with 147 additions and 114 deletions
|
@ -18,13 +18,14 @@ pub(crate) unsafe fn is_platform_object_same_origin(
|
|||
cx: SafeJSContext,
|
||||
obj: RawHandleObject,
|
||||
) -> bool {
|
||||
let subject_realm = get_context_realm(*cx);
|
||||
let obj_realm = GetObjectRealmOrNull(*obj);
|
||||
let subject_realm = unsafe { get_context_realm(*cx) };
|
||||
let obj_realm = unsafe { GetObjectRealmOrNull(*obj) };
|
||||
assert!(!obj_realm.is_null());
|
||||
|
||||
let subject_principals =
|
||||
ServoJSPrincipalsRef::from_raw_unchecked(GetRealmPrincipals(subject_realm));
|
||||
let obj_principals = ServoJSPrincipalsRef::from_raw_unchecked(GetRealmPrincipals(obj_realm));
|
||||
unsafe { ServoJSPrincipalsRef::from_raw_unchecked(GetRealmPrincipals(subject_realm)) };
|
||||
let obj_principals =
|
||||
unsafe { ServoJSPrincipalsRef::from_raw_unchecked(GetRealmPrincipals(obj_realm)) };
|
||||
|
||||
let subject_origin = subject_principals.origin();
|
||||
let obj_origin = obj_principals.origin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue