mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -15,7 +15,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::Event;
|
||||
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#extendable-event
|
||||
#[dom_struct]
|
||||
|
@ -39,7 +39,7 @@ impl ExtendableEvent {
|
|||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
) -> DomRoot<ExtendableEvent> {
|
||||
Self::new_with_proto(worker, None, type_, bubbles, cancelable)
|
||||
Self::new_with_proto(worker, None, type_, bubbles, cancelable, CanGc::note())
|
||||
}
|
||||
|
||||
fn new_with_proto(
|
||||
|
@ -48,11 +48,13 @@ impl ExtendableEvent {
|
|||
type_: Atom,
|
||||
bubbles: bool,
|
||||
cancelable: bool,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<ExtendableEvent> {
|
||||
let ev = reflect_dom_object_with_proto(
|
||||
Box::new(ExtendableEvent::new_inherited()),
|
||||
worker,
|
||||
proto,
|
||||
can_gc,
|
||||
);
|
||||
{
|
||||
let event = ev.upcast::<Event>();
|
||||
|
@ -64,6 +66,7 @@ impl ExtendableEvent {
|
|||
pub fn Constructor(
|
||||
worker: &ServiceWorkerGlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
type_: DOMString,
|
||||
init: &ExtendableEventBinding::ExtendableEventInit,
|
||||
) -> Fallible<DomRoot<ExtendableEvent>> {
|
||||
|
@ -73,6 +76,7 @@ impl ExtendableEvent {
|
|||
Atom::from(type_),
|
||||
init.parent.bubbles,
|
||||
init.parent.cancelable,
|
||||
can_gc,
|
||||
))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue