mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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
|
@ -16,6 +16,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CloseEvent {
|
||||
|
@ -46,7 +47,15 @@ impl CloseEvent {
|
|||
reason: DOMString,
|
||||
) -> DomRoot<CloseEvent> {
|
||||
Self::new_with_proto(
|
||||
global, None, type_, bubbles, cancelable, wasClean, code, reason,
|
||||
global,
|
||||
None,
|
||||
type_,
|
||||
bubbles,
|
||||
cancelable,
|
||||
wasClean,
|
||||
code,
|
||||
reason,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -60,9 +69,10 @@ impl CloseEvent {
|
|||
wasClean: bool,
|
||||
code: u16,
|
||||
reason: DOMString,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CloseEvent> {
|
||||
let event = Box::new(CloseEvent::new_inherited(wasClean, code, reason));
|
||||
let ev = reflect_dom_object_with_proto(event, global, proto);
|
||||
let ev = reflect_dom_object_with_proto(event, global, proto, can_gc);
|
||||
{
|
||||
let event = ev.upcast::<Event>();
|
||||
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||
|
@ -73,6 +83,7 @@ impl CloseEvent {
|
|||
pub fn Constructor(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
type_: DOMString,
|
||||
init: &CloseEventBinding::CloseEventInit,
|
||||
) -> Fallible<DomRoot<CloseEvent>> {
|
||||
|
@ -87,6 +98,7 @@ impl CloseEvent {
|
|||
init.wasClean,
|
||||
init.code,
|
||||
init.reason.clone(),
|
||||
can_gc,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue