From a6218b42eafa9a1e6f845d7f709a108005ed58a8 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 29 Jan 2025 02:40:25 -0500 Subject: bindings: Move string-related bindings code to script_bindings. (#35172) Signed-off-by: Josh Matthews --- components/script_bindings/trace.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 components/script_bindings/trace.rs (limited to 'components/script_bindings/trace.rs') diff --git a/components/script_bindings/trace.rs b/components/script_bindings/trace.rs new file mode 100644 index 00000000000..29317e7fda6 --- /dev/null +++ b/components/script_bindings/trace.rs @@ -0,0 +1,24 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use crate::str::{DOMString, USVString}; + +/// For use on non-jsmanaged types +/// Use #[derive(JSTraceable)] on JS managed types +macro_rules! unsafe_no_jsmanaged_fields( + ($($ty:ty),+) => ( + $( + #[allow(unsafe_code)] + unsafe impl crate::JSTraceable for $ty { + #[inline] + unsafe fn trace(&self, _: *mut ::js::jsapi::JSTracer) { + // Do nothing + } + } + )+ + ); +); + +unsafe_no_jsmanaged_fields!(DOMString); +unsafe_no_jsmanaged_fields!(USVString); -- cgit v1.2.3