mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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
|
@ -9,7 +9,7 @@ use dom_struct::dom_struct;
|
|||
use embedder_traits::{DualRumbleEffectParams, EmbedderMsg};
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::MutableHandleValue;
|
||||
use script_traits::GamepadSupportedHapticEffects;
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
|
@ -134,8 +134,8 @@ impl GamepadHapticActuator {
|
|||
|
||||
impl GamepadHapticActuatorMethods for GamepadHapticActuator {
|
||||
/// <https://www.w3.org/TR/gamepad/#dom-gamepadhapticactuator-effects>
|
||||
fn Effects(&self, cx: JSContext) -> JSVal {
|
||||
to_frozen_array(self.effects.as_slice(), cx)
|
||||
fn Effects(&self, cx: JSContext, retval: MutableHandleValue) {
|
||||
to_frozen_array(self.effects.as_slice(), cx, retval)
|
||||
}
|
||||
|
||||
/// <https://www.w3.org/TR/gamepad/#dom-gamepadhapticactuator-playeffect>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue