diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 86bcc6d8ad2..970281c2977 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -301,7 +301,9 @@ impl HeapGCValue for JSVal { impl HeapGCValue for JS { } -/// A mutable holder for a GC-owned SpiderMonkey value stored on the heap. +/// A holder that provides interior mutability for GC-managed values such as +/// `JSVal` and `JS`. +/// /// Must be used in place of traditional interior mutability to ensure proper /// GC barriers are enforced. #[must_root] @@ -600,7 +602,11 @@ impl, U: Reflectable> TemporaryPushable for Vec> { } } -/// An opaque, LIFO rooting mechanism. +/// An opaque, LIFO rooting mechanism. This tracks roots and ensures that they +/// are destructed in a LIFO order. +/// +/// See also [*Exact Stack Rooting - Storing a GCPointer on the CStack*] +/// (https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Internals/GC/Exact_Stack_Rooting). pub struct RootCollection { roots: UnsafeCell>, }