aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/rtcdatachannelevent.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/rtcdatachannelevent.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/rtcdatachannelevent.rs')
-rw-r--r--components/script/dom/rtcdatachannelevent.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/components/script/dom/rtcdatachannelevent.rs b/components/script/dom/rtcdatachannelevent.rs
index 1b245a06b56..cbea553736f 100644
--- a/components/script/dom/rtcdatachannelevent.rs
+++ b/components/script/dom/rtcdatachannelevent.rs
@@ -18,6 +18,7 @@ use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
use crate::dom::rtcdatachannel::RTCDataChannel;
use crate::dom::window::Window;
+use crate::script_runtime::CanGc;
#[dom_struct]
pub struct RTCDataChannelEvent {
@@ -40,7 +41,15 @@ impl RTCDataChannelEvent {
cancelable: bool,
channel: &RTCDataChannel,
) -> DomRoot<RTCDataChannelEvent> {
- Self::new_with_proto(global, None, type_, bubbles, cancelable, channel)
+ Self::new_with_proto(
+ global,
+ None,
+ type_,
+ bubbles,
+ cancelable,
+ channel,
+ CanGc::note(),
+ )
}
fn new_with_proto(
@@ -50,11 +59,13 @@ impl RTCDataChannelEvent {
bubbles: bool,
cancelable: bool,
channel: &RTCDataChannel,
+ can_gc: CanGc,
) -> DomRoot<RTCDataChannelEvent> {
let event = reflect_dom_object_with_proto(
Box::new(RTCDataChannelEvent::new_inherited(channel)),
global,
proto,
+ can_gc,
);
{
let event = event.upcast::<Event>();
@@ -67,6 +78,7 @@ impl RTCDataChannelEvent {
pub fn Constructor(
window: &Window,
proto: Option<HandleObject>,
+ can_gc: CanGc,
type_: DOMString,
init: &RTCDataChannelEventInit,
) -> DomRoot<RTCDataChannelEvent> {
@@ -77,6 +89,7 @@ impl RTCDataChannelEvent {
init.parent.bubbles,
init.parent.cancelable,
&init.channel,
+ can_gc,
)
}
}