mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
script: Move operations in window_named_properties::get_own_property_descriptor
& webdriver_handlers::clone_an_object
into unsafe blocks (#38951)
Testing: Covered by existing tests Part of https://github.com/servo/servo/issues/35955 Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
87fe202ded
commit
de6feb469a
3 changed files with 87 additions and 57 deletions
|
@ -89,11 +89,13 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
let cx = unsafe { SafeJSContext::from_ptr(cx) };
|
||||
|
||||
if id.is_symbol() {
|
||||
if id.get().asBits_ == SymbolId(GetWellKnownSymbol(*cx, SymbolCode::toStringTag)).asBits_ {
|
||||
if id.get().asBits_ ==
|
||||
SymbolId(unsafe { GetWellKnownSymbol(*cx, SymbolCode::toStringTag) }).asBits_
|
||||
{
|
||||
rooted!(in(*cx) let mut rval = UndefinedValue());
|
||||
"WindowProperties".to_jsval(*cx, rval.handle_mut());
|
||||
unsafe { "WindowProperties".to_jsval(*cx, rval.handle_mut()) };
|
||||
set_property_descriptor(
|
||||
RustMutableHandle::from_raw(desc),
|
||||
unsafe { RustMutableHandle::from_raw(desc) },
|
||||
rval.handle(),
|
||||
JSPROP_READONLY.into(),
|
||||
unsafe { &mut *is_none },
|
||||
|
@ -103,12 +105,15 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
}
|
||||
|
||||
let mut found = false;
|
||||
if !has_property_on_prototype(
|
||||
*cx,
|
||||
RustHandle::from_raw(proxy),
|
||||
RustHandle::from_raw(id),
|
||||
&mut found,
|
||||
) {
|
||||
let lookup_succeeded = unsafe {
|
||||
has_property_on_prototype(
|
||||
*cx,
|
||||
RustHandle::from_raw(proxy),
|
||||
RustHandle::from_raw(id),
|
||||
&mut found,
|
||||
)
|
||||
};
|
||||
if !lookup_succeeded {
|
||||
return false;
|
||||
}
|
||||
if found {
|
||||
|
@ -136,7 +141,9 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
.expect("global is not a window");
|
||||
if let Some(obj) = window.NamedGetter(s.into()) {
|
||||
rooted!(in(*cx) let mut rval = UndefinedValue());
|
||||
obj.to_jsval(*cx, rval.handle_mut());
|
||||
unsafe {
|
||||
obj.to_jsval(*cx, rval.handle_mut());
|
||||
}
|
||||
set_property_descriptor(
|
||||
unsafe { RustMutableHandle::from_raw(desc) },
|
||||
rval.handle(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue