mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +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
|
@ -11,6 +11,7 @@ use std::rc::Rc;
|
|||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsval::JSVal;
|
||||
use profile_traits::ipc;
|
||||
use webxr_api::{self, Error as XRError, MockDeviceInit, MockDeviceMsg};
|
||||
|
||||
|
@ -184,7 +185,8 @@ impl XRTestMethods for XRTest {
|
|||
/// <https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md>
|
||||
fn SimulateUserActivation(&self, f: Rc<Function>) {
|
||||
ScriptThread::set_user_interacting(true);
|
||||
let _ = f.Call__(vec![], ExceptionHandling::Rethrow);
|
||||
rooted!(in(*GlobalScope::get_cx()) let mut value: JSVal);
|
||||
let _ = f.Call__(vec![], value.handle_mut(), ExceptionHandling::Rethrow);
|
||||
ScriptThread::set_user_interacting(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue