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
|
@ -6,8 +6,7 @@ use std::cell::Cell;
|
|||
use std::rc::Rc;
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::HandleObject;
|
||||
use js::rust::{HandleObject, MutableHandleValue};
|
||||
|
||||
use crate::dom::bindings::callback::ExceptionHandling;
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
|
@ -137,10 +136,10 @@ impl PerformanceObserverMethods for PerformanceObserver {
|
|||
}
|
||||
|
||||
// https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute
|
||||
fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope) -> JSVal {
|
||||
fn SupportedEntryTypes(cx: JSContext, global: &GlobalScope, retval: MutableHandleValue) {
|
||||
// While this is exposed through a method of PerformanceObserver,
|
||||
// it is specified as associated with the global scope.
|
||||
global.supported_performance_entry_types(cx)
|
||||
global.supported_performance_entry_types(cx, retval)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/performance-timeline/#dom-performanceobserver-observe()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue