From 25a0764a37a585d032ca352923b24995f8cbf1a0 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Tue, 5 Nov 2024 03:29:08 -0500 Subject: 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 * Update mozjs. Signed-off-by: Josh Matthews * Fix clippy warnings. Signed-off-by: Josh Matthews --------- Signed-off-by: Josh Matthews --- components/script/dom/csslayerstatementrule.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/script/dom/csslayerstatementrule.rs') diff --git a/components/script/dom/csslayerstatementrule.rs b/components/script/dom/csslayerstatementrule.rs index 9a4aa5a0dc9..dd9e632701d 100644 --- a/components/script/dom/csslayerstatementrule.rs +++ b/components/script/dom/csslayerstatementrule.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use js::jsval::JSVal; +use js::rust::MutableHandleValue; use servo_arc::Arc; use style::shared_lock::ToCssWithGuard; use style::stylesheets::{CssRuleType, LayerStatementRule}; @@ -67,13 +67,13 @@ impl SpecificCSSRule for CSSLayerStatementRule { impl CSSLayerStatementRuleMethods for CSSLayerStatementRule { /// - fn NameList(&self, cx: SafeJSContext) -> JSVal { + fn NameList(&self, cx: SafeJSContext, retval: MutableHandleValue) { let names: Vec = self .layerstatementrule .names .iter() .map(|name| DOMString::from_string(name.to_css_string())) .collect(); - to_frozen_array(names.as_slice(), cx) + to_frozen_array(names.as_slice(), cx, retval) } } -- cgit v1.2.3