mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
parent
05ee551af8
commit
ac7419cf57
2 changed files with 12 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue