mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -14,7 +14,7 @@ use euclid::{RigidTransform3D, Transform3D, Vector3D};
|
|||
use ipc_channel::ipc::IpcReceiver;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsapi::JSObject;
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::MutableHandleValue;
|
||||
use js::typedarray::Float32Array;
|
||||
use profile_traits::ipc;
|
||||
use servo_atoms::Atom;
|
||||
|
@ -1011,10 +1011,10 @@ impl XRSessionMethods for XRSession {
|
|||
}
|
||||
|
||||
/// <https://www.w3.org/TR/webxr/#dom-xrsession-enabledfeatures>
|
||||
fn EnabledFeatures(&self, cx: JSContext) -> JSVal {
|
||||
fn EnabledFeatures(&self, cx: JSContext, retval: MutableHandleValue) {
|
||||
let session = self.session.borrow();
|
||||
let features = session.granted_features();
|
||||
to_frozen_array(features, cx)
|
||||
to_frozen_array(features, cx, retval)
|
||||
}
|
||||
|
||||
/// <https://www.w3.org/TR/webxr/#dom-xrsession-issystemkeyboardsupported>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue