aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/timers.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2024-11-05 03:29:08 -0500
committerGitHub <noreply@github.com>2024-11-05 08:29:08 +0000
commit25a0764a37a585d032ca352923b24995f8cbf1a0 (patch)
tree1805edc4fc79396de9150f8bc063888926d53d3b /components/script/timers.rs
parent537958a3ccb57502c558e4da0963307fd7481a14 (diff)
downloadservo-25a0764a37a585d032ca352923b24995f8cbf1a0.tar.gz
servo-25a0764a37a585d032ca352923b24995f8cbf1a0.zip
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>
Diffstat (limited to 'components/script/timers.rs')
-rw-r--r--components/script/timers.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs
index b10a356f7c9..d3148f8f00d 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -563,7 +563,8 @@ impl JsTimerTask {
},
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
let arguments = self.collect_heap_args(arguments);
- let _ = function.Call_(this, arguments, Report);
+ rooted!(in(*GlobalScope::get_cx()) let mut value: JSVal);
+ let _ = function.Call_(this, arguments, value.handle_mut(), Report);
},
};
ScriptThread::set_user_interacting(was_user_interacting);