mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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
|
@ -8,7 +8,7 @@ use std::rc::Rc;
|
|||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{Heap, JSObject};
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::{HandleObject, HandleValue};
|
||||
use js::rust::{HandleObject, HandleValue, MutableHandleValue};
|
||||
use servo_atoms::Atom;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||
|
@ -127,8 +127,8 @@ impl PromiseRejectionEventMethods for PromiseRejectionEvent {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-promiserejectionevent-reason
|
||||
fn Reason(&self, _cx: JSContext) -> JSVal {
|
||||
self.reason.get()
|
||||
fn Reason(&self, _cx: JSContext, mut retval: MutableHandleValue) {
|
||||
retval.set(self.reason.get())
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-istrusted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue