diff options
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r-- | components/script/dom/bindings/callback.rs | 14 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/mod.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/refcounted.rs | 14 | ||||
-rw-r--r-- | components/script/dom/bindings/reflector.rs | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/root.rs | 40 | ||||
-rw-r--r-- | components/script/dom/bindings/settings_stack.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/trace.rs | 14 | ||||
-rw-r--r-- | components/script/dom/bindings/weakref.rs | 10 |
9 files changed, 53 insertions, 53 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 4554c34683c..0cad20d3255 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -42,7 +42,7 @@ pub enum ExceptionHandling { /// A common base class for representing IDL callback function and /// callback interface types. #[derive(JSTraceable)] -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct CallbackObject { /// The underlying `JSObject`. callback: Heap<*mut JSObject>, @@ -63,14 +63,14 @@ pub struct CallbackObject { } impl Default for CallbackObject { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn default() -> CallbackObject { CallbackObject::new() } } impl CallbackObject { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn new() -> CallbackObject { CallbackObject { callback: Heap::default(), @@ -133,14 +133,14 @@ pub trait CallbackContainer { /// A common base class for representing IDL callback function types. #[derive(JSTraceable, PartialEq)] -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct CallbackFunction { object: CallbackObject, } impl CallbackFunction { /// Create a new `CallbackFunction` for this object. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn new() -> CallbackFunction { CallbackFunction { object: CallbackObject::new(), @@ -161,7 +161,7 @@ impl CallbackFunction { /// A common base class for representing IDL callback interface types. #[derive(JSTraceable, PartialEq)] -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct CallbackInterface { object: CallbackObject, } @@ -241,7 +241,7 @@ pub struct CallSetup { impl CallSetup { /// Performs the setup needed to make a call. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn new<T: CallbackContainer>(callback: &T, handling: ExceptionHandling) -> CallSetup { let global = unsafe { GlobalScope::from_object(callback.callback()) }; if let Some(window) = global.downcast::<Window>() { diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 471c152040b..361d6d60edb 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -6906,7 +6906,7 @@ class CGDictionary(CGThing): derive = ["JSTraceable"] mustRoot = "" if self.membersNeedTracing(): - mustRoot = "#[unrooted_must_root_lint::must_root]\n" + mustRoot = "#[crown::unrooted_must_root_lint::must_root]\n" if not self.hasRequiredFields(self.dictionary): derive += ["Default"] @@ -7450,7 +7450,7 @@ class CGCallback(CGClass): constructors=self.getConstructors(), methods=realMethods, decorators="#[derive(JSTraceable, PartialEq)]\n" - "#[unrooted_must_root_lint::allow_unrooted_interior]") + "#[crown::unrooted_must_root_lint::allow_unrooted_interior]") def getConstructors(self): return [ClassConstructor( diff --git a/components/script/dom/bindings/mod.rs b/components/script/dom/bindings/mod.rs index 9263fca2ba6..85bfad112c1 100644 --- a/components/script/dom/bindings/mod.rs +++ b/components/script/dom/bindings/mod.rs @@ -165,7 +165,7 @@ pub mod xmlname; /// Generated JS-Rust bindings. #[allow(missing_docs, non_snake_case)] pub mod codegen { - #[allow(dead_code, unrooted_must_root)] + #[allow(dead_code, crown::unrooted_must_root)] pub mod Bindings { include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs")); } diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 0279e98b6ba..3bf2dcef22e 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -80,7 +80,7 @@ impl TrustedPromise { /// Create a new `TrustedPromise` instance from an existing DOM object. The object will /// be prevented from being GCed for the duration of the resulting `TrustedPromise` object's /// lifetime. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn new(promise: Rc<Promise>) -> TrustedPromise { LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); @@ -130,7 +130,7 @@ impl TrustedPromise { } /// A task which will reject the promise. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn reject_task(self, error: Error) -> impl TaskOnce { let this = self; task!(reject_promise: move || { @@ -140,7 +140,7 @@ impl TrustedPromise { } /// A task which will resolve the promise. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn resolve_task<T>(self, value: T) -> impl TaskOnce where T: ToJSValConvertible + Send, @@ -157,7 +157,7 @@ impl TrustedPromise { /// shared among threads for use in asynchronous operations. The underlying /// DOM object is guaranteed to live at least as long as the last outstanding /// `Trusted<T>` instance. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct Trusted<T: DomObject> { /// A pointer to the Rust DOM object of type T, but void to allow /// sending `Trusted<T>` between threads, regardless of T's sendability. @@ -220,7 +220,7 @@ impl<T: DomObject> Clone for Trusted<T> { /// The set of live, pinned DOM objects that are currently prevented /// from being garbage collected due to outstanding references. -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] pub struct LiveDOMReferences { // keyed on pointer to Rust DOM object reflectable_table: RefCell<HashMap<*const libc::c_void, Weak<TrustedReference>>>, @@ -244,7 +244,7 @@ impl LiveDOMReferences { }); } - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn addref_promise(&self, promise: Rc<Promise>) { let mut table = self.promise_table.borrow_mut(); table.entry(&*promise).or_insert(vec![]).push(promise) @@ -294,7 +294,7 @@ fn remove_nulls<K: Eq + Hash + Clone, V>(table: &mut HashMap<K, Weak<V>>) { } /// A JSTraceDataOp for tracing reflectors held in LIVE_REFERENCES -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] pub unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) { info!("tracing live refcounted references"); LIVE_REFERENCES.with(|ref r| { diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 4b1ba97c525..081fe38312b 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -42,16 +42,16 @@ where } /// A struct to store a reference to the reflector of a DOM object. -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] #[derive(MallocSizeOf)] -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] // If you're renaming or moving this field, update the path in plugins::reflector as well pub struct Reflector { #[ignore_malloc_size_of = "defined and measured in rust-mozjs"] object: Heap<*mut JSObject>, } -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] impl PartialEq for Reflector { fn eq(&self, other: &Reflector) -> bool { self.object.get() == other.object.get() diff --git a/components/script/dom/bindings/root.rs b/components/script/dom/bindings/root.rs index 1e67474ea99..68f754628bc 100644 --- a/components/script/dom/bindings/root.rs +++ b/components/script/dom/bindings/root.rs @@ -44,8 +44,8 @@ use crate::dom::bindings::trace::{trace_reflector, JSTraceable}; use crate::dom::node::Node; /// A rooted value. -#[allow(unrooted_must_root)] -#[unrooted_must_root_lint::allow_unrooted_interior] +#[allow(crown::unrooted_must_root)] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct Root<T: StableTraceObject> { /// The value to root. value: T, @@ -60,7 +60,7 @@ where /// Create a new stack-bounded root for the provided value. /// It cannot outlive its associated `RootCollection`, and it gives /// out references which cannot outlive this new `Root`. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn new(value: T) -> Self { unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection { assert_in_script(); @@ -92,7 +92,7 @@ where // The JSTraceable impl for Reflector doesn't actually do anything, // so we need this shenanigan to actually trace the reflector of the // T pointer in Dom<T>. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] struct ReflectorStackRoot(Reflector); unsafe impl JSTraceable for ReflectorStackRoot { unsafe fn trace(&self, tracer: *mut JSTracer) { @@ -111,7 +111,7 @@ where // The JSTraceable impl for Reflector doesn't actually do anything, // so we need this shenanigan to actually trace the reflector of the // T pointer in Dom<T>. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] struct MaybeUnreflectedStackRoot<T>(T); unsafe impl<T> JSTraceable for MaybeUnreflectedStackRoot<T> where @@ -316,7 +316,7 @@ where /// on the stack, the `Dom<T>` can point to freed memory. /// /// This should only be used as a field in other DOM objects. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct Dom<T> { ptr: ptr::NonNull<T>, } @@ -341,7 +341,7 @@ impl<T> Dom<T> { impl<T: DomObject> Dom<T> { /// Create a Dom<T> from a &T - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn from_ref(obj: &T) -> Dom<T> { assert_in_script(); Dom { @@ -375,7 +375,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> { } /// A traced reference to a DOM object that may not be reflected yet. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct MaybeUnreflectedDom<T> { ptr: ptr::NonNull<T>, } @@ -384,7 +384,7 @@ impl<T> MaybeUnreflectedDom<T> where T: DomObject, { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn from_box(value: Box<T>) -> Self { Self { ptr: Box::leak(value).into(), @@ -416,7 +416,7 @@ where /// An unrooted reference to a DOM object for use in layout. `Layout*Helpers` /// traits must be implemented on this. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct LayoutDom<'dom, T> { value: &'dom T, } @@ -505,7 +505,7 @@ impl<T> Hash for LayoutDom<'_, T> { impl<T> Clone for Dom<T> { #[inline] - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn clone(&self) -> Self { assert_in_script(); Dom { @@ -539,7 +539,7 @@ impl LayoutDom<'_, Node> { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] #[derive(JSTraceable)] pub struct MutDom<T: DomObject> { val: UnsafeCell<Dom<T>>, @@ -602,7 +602,7 @@ pub(crate) fn assert_in_layout() { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] #[derive(JSTraceable)] pub struct MutNullableDom<T: DomObject> { ptr: UnsafeCell<Option<Dom<T>>>, @@ -636,14 +636,14 @@ impl<T: DomObject> MutNullableDom<T> { /// Retrieve a copy of the inner optional `Dom<T>` as `LayoutDom<T>`. /// For use by layout, which can't use safe types like Temporary. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> { assert_in_layout(); (*self.ptr.get()).as_ref().map(|js| js.to_layout()) } /// Get a rooted value out of this object - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn get(&self) -> Option<DomRoot<T>> { assert_in_script(); unsafe { ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) } @@ -678,7 +678,7 @@ impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableDom<T> { } impl<T: DomObject> Default for MutNullableDom<T> { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn default() -> MutNullableDom<T> { assert_in_script(); MutNullableDom { @@ -700,7 +700,7 @@ impl<T: DomObject> MallocSizeOf for MutNullableDom<T> { /// /// This should only be used as a field in other DOM objects; see warning /// on `Dom<T>`. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct DomOnceCell<T: DomObject> { ptr: OnceCell<Dom<T>>, } @@ -711,7 +711,7 @@ where { /// Retrieve a copy of the current inner value. If it is `None`, it is /// initialized with the result of `cb` first. - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] pub fn init_once<F>(&self, cb: F) -> &T where F: FnOnce() -> DomRoot<T>, @@ -722,7 +722,7 @@ where } impl<T: DomObject> Default for DomOnceCell<T> { - #[allow(unrooted_must_root)] + #[allow(crown::unrooted_must_root)] fn default() -> DomOnceCell<T> { assert_in_script(); DomOnceCell { @@ -738,7 +738,7 @@ impl<T: DomObject> MallocSizeOf for DomOnceCell<T> { } } -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> { unsafe fn trace(&self, trc: *mut JSTracer) { if let Some(ptr) = self.ptr.get() { diff --git a/components/script/dom/bindings/settings_stack.rs b/components/script/dom/bindings/settings_stack.rs index 6461a790025..f25de95ee7c 100644 --- a/components/script/dom/bindings/settings_stack.rs +++ b/components/script/dom/bindings/settings_stack.rs @@ -20,7 +20,7 @@ enum StackEntryKind { Entry, } -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] #[derive(JSTraceable)] struct StackEntry { global: Dom<GlobalScope>, diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 99abcf07e3d..3d730dff605 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -100,7 +100,7 @@ unsafe impl<T: JSTraceable> CustomTraceable for OnceCell<T> { /// /// SAFETY: Inner type must not impl JSTraceable #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -#[trace_in_no_trace_lint::must_not_have_traceable] +#[crown::trace_in_no_trace_lint::must_not_have_traceable] pub struct NoTrace<T>(pub T); impl<T: Display> Display for NoTrace<T> { @@ -130,7 +130,7 @@ impl<T: MallocSizeOf> MallocSizeOf for NoTrace<T> { /// HashMap wrapper, that has non-jsmanaged keys /// /// Not all methods are reexposed, but you can access inner type via .0 -#[trace_in_no_trace_lint::must_not_have_traceable(0)] +#[crown::trace_in_no_trace_lint::must_not_have_traceable(0)] #[derive(Clone, Debug)] pub struct HashMapTracedValues<K, V, S = RandomState>(pub HashMap<K, V, S>); @@ -276,7 +276,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: &Heap<JSVal>) } /// Trace the `JSObject` held by `reflector`. -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) { trace!("tracing reflector {}", description); trace_object(tracer, description, reflector.rootable()) @@ -482,7 +482,7 @@ pub use js::gc::RootedTraceableSet; /// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you know what you're doing, use this. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct RootedTraceableBox<T: JSTraceable + 'static>(js::gc::RootedTraceableBox<T>); unsafe impl<T: JSTraceable + 'static> JSTraceable for RootedTraceableBox<T> { @@ -547,9 +547,9 @@ impl<T: JSTraceable> DerefMut for RootedTraceableBox<T> { /// Guaranteed to be empty when not rooted. /// Usage: `rooted_vec!(let mut v);` or if you have an /// iterator of `DomRoot`s, `rooted_vec!(let v <- iterator);`. -#[allow(unrooted_must_root)] +#[allow(crown::unrooted_must_root)] #[derive(JSTraceable)] -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct RootableVec<T: JSTraceable> { v: Vec<T>, } @@ -562,7 +562,7 @@ impl<T: JSTraceable> RootableVec<T> { } /// A vector of items that are rooted for the lifetime 'a. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct RootedVec<'a, T: 'static + JSTraceable> { root: &'a mut RootableVec<T>, } diff --git a/components/script/dom/bindings/weakref.rs b/components/script/dom/bindings/weakref.rs index a0bd0ea362d..57bf219de4f 100644 --- a/components/script/dom/bindings/weakref.rs +++ b/components/script/dom/bindings/weakref.rs @@ -33,14 +33,14 @@ use crate::dom::bindings::trace::JSTraceable; pub const DOM_WEAK_SLOT: u32 = 1; /// A weak reference to a JS-managed DOM object. -#[allow(unrooted_must_root)] -#[unrooted_must_root_lint::allow_unrooted_interior] +#[allow(crown::unrooted_must_root)] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct WeakRef<T: WeakReferenceable> { ptr: ptr::NonNull<WeakBox<T>>, } /// The inner box of weak references, public for the finalization in codegen. -#[unrooted_must_root_lint::must_root] +#[crown::unrooted_must_root_lint::must_root] pub struct WeakBox<T: WeakReferenceable> { /// The reference count. When it reaches zero, the `value` field should /// have already been set to `None`. The pointee contributes one to the count. @@ -218,7 +218,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> { /// A vector of weak references. On tracing, the vector retains /// only references which still point to live objects. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[derive(MallocSizeOf)] pub struct WeakRefVec<T: WeakReferenceable> { vec: Vec<WeakRef<T>>, @@ -268,7 +268,7 @@ impl<T: WeakReferenceable> DerefMut for WeakRefVec<T> { /// An entry of a vector of weak references. Passed to the closure /// given to `WeakRefVec::update`. -#[unrooted_must_root_lint::allow_unrooted_interior] +#[crown::unrooted_must_root_lint::allow_unrooted_interior] pub struct WeakRefEntry<'a, T: WeakReferenceable> { vec: &'a mut WeakRefVec<T>, index: &'a mut usize, |