mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Allow unsafe_op_in_unsafe_fn lint This lint warns by default in the 2024 edition, but is *way* too noisy for servo. We might enable it in the future, but not now. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Compile using the 2024 edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
eb2ca42824
commit
bb0d08432e
66 changed files with 317 additions and 293 deletions
|
@ -85,7 +85,7 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
desc: MutableHandle<PropertyDescriptor>,
|
||||
is_none: *mut bool,
|
||||
) -> bool {
|
||||
let cx = SafeJSContext::from_ptr(cx);
|
||||
let cx = unsafe { SafeJSContext::from_ptr(cx) };
|
||||
|
||||
if id.is_symbol() {
|
||||
if id.get().asBits_ == SymbolId(GetWellKnownSymbol(*cx, SymbolCode::toStringTag)).asBits_ {
|
||||
|
@ -95,7 +95,7 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
RustMutableHandle::from_raw(desc),
|
||||
rval.handle(),
|
||||
JSPROP_READONLY.into(),
|
||||
&mut *is_none,
|
||||
unsafe { &mut *is_none },
|
||||
);
|
||||
}
|
||||
return true;
|
||||
|
@ -115,7 +115,7 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
}
|
||||
|
||||
let s = if id.is_string() {
|
||||
jsstr_to_string(*cx, id.to_string())
|
||||
unsafe { jsstr_to_string(*cx, id.to_string()) }
|
||||
} else if id.is_int() {
|
||||
// If the property key is an integer index, convert it to a String too.
|
||||
// For indexed access on the window object, which may shadow this, see
|
||||
|
@ -131,16 +131,16 @@ unsafe extern "C" fn get_own_property_descriptor(
|
|||
return true;
|
||||
}
|
||||
|
||||
let window = Root::downcast::<Window>(GlobalScope::from_object(proxy.get()))
|
||||
let window = Root::downcast::<Window>(unsafe { GlobalScope::from_object(proxy.get()) })
|
||||
.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());
|
||||
set_property_descriptor(
|
||||
RustMutableHandle::from_raw(desc),
|
||||
unsafe { RustMutableHandle::from_raw(desc) },
|
||||
rval.handle(),
|
||||
0,
|
||||
&mut *is_none,
|
||||
unsafe { &mut *is_none },
|
||||
);
|
||||
}
|
||||
true
|
||||
|
@ -155,8 +155,10 @@ unsafe extern "C" fn own_property_keys(
|
|||
// TODO is this all we need to return? compare with gecko:
|
||||
// https://searchfox.org/mozilla-central/rev/af78418c4b5f2c8721d1a06486cf4cf0b33e1e8d/dom/base/WindowNamedPropertiesHandler.cpp#175-232
|
||||
// see also https://github.com/whatwg/html/issues/9068
|
||||
rooted!(in(cx) let mut rooted = SymbolId(GetWellKnownSymbol(cx, SymbolCode::toStringTag)));
|
||||
AppendToIdVector(props, rooted.handle().into());
|
||||
unsafe {
|
||||
rooted!(in(cx) let mut rooted = SymbolId(GetWellKnownSymbol(cx, SymbolCode::toStringTag)));
|
||||
AppendToIdVector(props, rooted.handle().into());
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -168,7 +170,9 @@ unsafe extern "C" fn define_property(
|
|||
_desc: Handle<PropertyDescriptor>,
|
||||
result: *mut ObjectOpResult,
|
||||
) -> bool {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_DEFINE_WINDOW_NAMED_PROPERTY as usize;
|
||||
unsafe {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_DEFINE_WINDOW_NAMED_PROPERTY as usize;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -179,7 +183,9 @@ unsafe extern "C" fn delete(
|
|||
_id: HandleId,
|
||||
result: *mut ObjectOpResult,
|
||||
) -> bool {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_DELETE_WINDOW_NAMED_PROPERTY as usize;
|
||||
unsafe {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_DELETE_WINDOW_NAMED_PROPERTY as usize;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -190,8 +196,10 @@ unsafe extern "C" fn get_prototype_if_ordinary(
|
|||
is_ordinary: *mut bool,
|
||||
proto: MutableHandleObject,
|
||||
) -> bool {
|
||||
*is_ordinary = true;
|
||||
proto.set(js::jsapi::GetStaticPrototype(proxy.get()));
|
||||
unsafe {
|
||||
*is_ordinary = true;
|
||||
proto.set(js::jsapi::GetStaticPrototype(proxy.get()));
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -201,7 +209,9 @@ unsafe extern "C" fn prevent_extensions(
|
|||
_proxy: HandleObject,
|
||||
result: *mut ObjectOpResult,
|
||||
) -> bool {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as usize;
|
||||
unsafe {
|
||||
(*result).code_ = JSErrNum::JSMSG_CANT_PREVENT_EXTENSIONS as usize;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -211,7 +221,9 @@ unsafe extern "C" fn is_extensible(
|
|||
_proxy: HandleObject,
|
||||
extensible: *mut bool,
|
||||
) -> bool {
|
||||
*extensible = true;
|
||||
unsafe {
|
||||
*extensible = true;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue