aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/extendableevent.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2024-08-22 07:42:36 -0400
committerGitHub <noreply@github.com>2024-08-22 11:42:36 +0000
commit60ef6bc46125d34e492a4294622e2791f3c619b5 (patch)
tree8bc8a90f3a4647a7d6565065a8d73bd1b8f29d3d /components/script/dom/extendableevent.rs
parent9a1051c9170abc8e40c43b2a6be712a3ff4b523f (diff)
downloadservo-60ef6bc46125d34e492a4294622e2791f3c619b5.tar.gz
servo-60ef6bc46125d34e492a4294622e2791f3c619b5.zip
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>
Diffstat (limited to 'components/script/dom/extendableevent.rs')
-rw-r--r--components/script/dom/extendableevent.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/extendableevent.rs b/components/script/dom/extendableevent.rs
index ad57747e5aa..2f9cd001dc0 100644
--- a/components/script/dom/extendableevent.rs
+++ b/components/script/dom/extendableevent.rs
@@ -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,
))
}