aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/window_named_properties.rs
diff options
context:
space:
mode:
authorSimon Wülker <simon.wuelker@arcor.de>2025-03-13 11:28:11 +0100
committerGitHub <noreply@github.com>2025-03-13 10:28:11 +0000
commitbb0d08432ee87054bbbda2cdef977fc5a28ee8de (patch)
treef0a71bb737927068212706eaf983c5f613eacb55 /components/script/window_named_properties.rs
parenteb2ca42824716faeab4cf31e275bb4136cc38e7d (diff)
downloadservo-bb0d08432ee87054bbbda2cdef977fc5a28ee8de.tar.gz
servo-bb0d08432ee87054bbbda2cdef977fc5a28ee8de.zip
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>
Diffstat (limited to 'components/script/window_named_properties.rs')
-rw-r--r--components/script/window_named_properties.rs40
1 files changed, 26 insertions, 14 deletions
diff --git a/components/script/window_named_properties.rs b/components/script/window_named_properties.rs
index a48a9ff6091..3c30cede7c3 100644
--- a/components/script/window_named_properties.rs
+++ b/components/script/window_named_properties.rs
@@ -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
}