aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_bindings/trace.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2025-01-29 02:40:25 -0500
committerGitHub <noreply@github.com>2025-01-29 07:40:25 +0000
commita6218b42eafa9a1e6f845d7f709a108005ed58a8 (patch)
treefa3c1bf16caad7f45cdf2f700b7007965952d10b /components/script_bindings/trace.rs
parent1188d2b2e7c18434f06df5505bed7cfd859f47e2 (diff)
downloadservo-a6218b42eafa9a1e6f845d7f709a108005ed58a8.tar.gz
servo-a6218b42eafa9a1e6f845d7f709a108005ed58a8.zip
bindings: Move string-related bindings code to script_bindings. (#35172)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Diffstat (limited to 'components/script_bindings/trace.rs')
-rw-r--r--components/script_bindings/trace.rs24
1 files changed, 24 insertions, 0 deletions
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);