mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Start marking functions that can transitively trigger a GC (#33144)
* Mark JS reflector wrappers as CanGc. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Propagate CanGc from reflect_dom_object_with_proto. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Mark DOM constructors as GC operations. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
9a1051c917
commit
60ef6bc461
140 changed files with 1336 additions and 304 deletions
|
@ -19,6 +19,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://w3c.github.io/uievents/#interface-uievent
|
||||
#[dom_struct]
|
||||
|
@ -38,14 +39,15 @@ impl UIEvent {
|
|||
}
|
||||
|
||||
pub fn new_uninitialized(window: &Window) -> DomRoot<UIEvent> {
|
||||
Self::new_uninitialized_with_proto(window, None)
|
||||
Self::new_uninitialized_with_proto(window, None, CanGc::note())
|
||||
}
|
||||
|
||||
fn new_uninitialized_with_proto(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<UIEvent> {
|
||||
reflect_dom_object_with_proto(Box::new(UIEvent::new_inherited()), window, proto)
|
||||
reflect_dom_object_with_proto(Box::new(UIEvent::new_inherited()), window, proto, can_gc)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
|
@ -56,7 +58,16 @@ impl UIEvent {
|
|||
view: Option<&Window>,
|
||||
detail: i32,
|
||||
) -> DomRoot<UIEvent> {
|
||||
Self::new_with_proto(window, None, type_, can_bubble, cancelable, view, detail)
|
||||
Self::new_with_proto(
|
||||
window,
|
||||
None,
|
||||
type_,
|
||||
can_bubble,
|
||||
cancelable,
|
||||
view,
|
||||
detail,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
@ -67,8 +78,9 @@ impl UIEvent {
|
|||
cancelable: EventCancelable,
|
||||
view: Option<&Window>,
|
||||
detail: i32,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<UIEvent> {
|
||||
let ev = UIEvent::new_uninitialized_with_proto(window, proto);
|
||||
let ev = UIEvent::new_uninitialized_with_proto(window, proto, can_gc);
|
||||
ev.InitUIEvent(
|
||||
type_,
|
||||
bool::from(can_bubble),
|
||||
|
@ -83,6 +95,7 @@ impl UIEvent {
|
|||
pub fn Constructor(
|
||||
window: &Window,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
type_: DOMString,
|
||||
init: &UIEventBinding::UIEventInit,
|
||||
) -> Fallible<DomRoot<UIEvent>> {
|
||||
|
@ -96,6 +109,7 @@ impl UIEvent {
|
|||
cancelable,
|
||||
init.view.as_deref(),
|
||||
init.detail,
|
||||
can_gc,
|
||||
);
|
||||
Ok(event)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue