mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Use out parameter for generated methods returning JSVal (#34087)
* Make generated bindings that return a WebIDL `any` value use out parameters. Returning raw JSVal values makes it easier to create GC hazards in code that calls these methods. Accepting a MutableHandle argument instead ensures that the values are rooted by the caller. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update mozjs. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Fix clippy warnings. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
537958a3cc
commit
25a0764a37
38 changed files with 763 additions and 515 deletions
|
@ -666,14 +666,3 @@ macro_rules! impl_rare_data (
|
|||
}
|
||||
);
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! optional_root_object_to_js_or_null {
|
||||
($cx: expr, $binding:expr) => {{
|
||||
rooted!(in($cx) let mut rval = NullValue());
|
||||
if let Some(object) = $binding {
|
||||
object.to_jsval($cx, rval.handle_mut());
|
||||
}
|
||||
rval.get()
|
||||
}};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue