Skip to content

Commit

Permalink
Fix rooting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Jun 29, 2020
1 parent 7eb44f8 commit 6ebb73d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/script/dom/rtcdatachannel.rs
Expand Up @@ -85,8 +85,6 @@ impl RTCDataChannel {
binary_type: DomRefCell::new(DOMString::from("blob")),
};

peer_connection.register_data_channel(servo_media_id, &channel);

channel
}

Expand All @@ -107,6 +105,8 @@ impl RTCDataChannel {
global,
);

peer_connection.register_data_channel(rtc_data_channel.servo_media_id, &*rtc_data_channel);

rtc_data_channel
}

Expand Down
11 changes: 8 additions & 3 deletions components/script/dom/rtcpeerconnection.rs
Expand Up @@ -35,7 +35,7 @@ use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent;
use crate::dom::rtcsessiondescription::RTCSessionDescription;
use crate::dom::rtctrackevent::RTCTrackEvent;
use crate::dom::window::Window;
use crate::realms::InRealm;
use crate::realms::{enter_realm, InRealm};
use crate::task::TaskCanceller;
use crate::task_source::networking::NetworkingTaskSource;
use crate::task_source::TaskSource;
Expand Down Expand Up @@ -161,6 +161,8 @@ impl WebRtcSignaller for RTCSignaller {
let _ = self.task_source.queue_with_canceller(
task!(on_data_channel_event: move || {
let this = this.root();
let global = this.global();
let _ac = enter_realm(&*global);
this.on_data_channel_event(channel, event);
}),
&self.canceller,
Expand Down Expand Up @@ -314,7 +316,10 @@ impl RTCPeerConnection {
let channel = if let Some(channel) = self.data_channels.borrow().get(&channel_id) {
DomRoot::from_ref(&**channel)
} else {
debug_assert!(false, "Got an event for an unregistered data channel");
warn!(
"Got an event for an unregistered data channel {:?}",
channel_id
);
return;
};

Expand All @@ -337,7 +342,7 @@ impl RTCPeerConnection {
.insert(id, Dom::from_ref(channel))
.is_some()
{
debug_assert!(false, "Data channel already registered");
warn!("Data channel already registered {:?}", id);
}
}

Expand Down

0 comments on commit 6ebb73d

Please sign in to comment.