Consistently use Dom in native promise handlers (#34167)

* Consistently use Dom in native promise handlers

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

* Fix crown errors

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>

---------

Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
This commit is contained in:
tanishka 2024-11-07 17:41:33 +05:30 committed by GitHub
parent 05ee551af8
commit ac7419cf57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -14,6 +14,10 @@ use crate::dom::globalscope::GlobalScope;
use crate::realms::InRealm;
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
/// Types that implement the `Callback` trait follow the same rooting requirements
/// as types that use the `#[dom_struct]` attribute.
/// Prefer storing `Dom<T>` members inside them instead of `DomRoot<T>`
/// to minimize redundant work by the garbage collector.
pub trait Callback: JSTraceable + MallocSizeOf {
fn callback(&self, cx: SafeJSContext, v: HandleValue, realm: InRealm, can_gc: CanGc);
}