diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2020-06-12 15:58:23 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2020-06-29 16:53:49 +0200 |
commit | 820ea452e78cda3e0a7c866d21bf675e34852367 (patch) | |
tree | 4132604663fe6ce02591ecb94e45e42280217f78 /components/script/dom/rtcdatachannel.rs | |
parent | 2dedcaeaaf050b347cc64fdd6681db879926b78d (diff) | |
download | servo-820ea452e78cda3e0a7c866d21bf675e34852367.tar.gz servo-820ea452e78cda3e0a7c866d21bf675e34852367.zip |
Set data channels as closed on peer connection close
Diffstat (limited to 'components/script/dom/rtcdatachannel.rs')
-rw-r--r-- | components/script/dom/rtcdatachannel.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs index 80d543f0441..c0a3db51cc4 100644 --- a/components/script/dom/rtcdatachannel.rs +++ b/components/script/dom/rtcdatachannel.rs @@ -133,6 +133,9 @@ impl RTCDataChannel { } pub fn on_error(&self, error: WebRtcError) { + let global = self.global(); + let cx = global.get_cx(); + let _ac = JSAutoRealm::new(*cx, self.reflector().get_jsobject().get()); let init = RTCErrorInit { errorDetail: RTCErrorDetailType::Data_channel_failure, httpRequestStatusCode: None, @@ -144,8 +147,8 @@ impl RTCDataChannel { let message = match error { WebRtcError::Backend(message) => DOMString::from(message), }; - let error = RTCError::new(&self.global(), &init, message); - let event = RTCErrorEvent::new(&self.global(), atom!("error"), false, false, &error); + let error = RTCError::new(&global, &init, message); + let event = RTCErrorEvent::new(&global, atom!("error"), false, false, &error); event.upcast::<Event>().fire(self.upcast()); } @@ -299,6 +302,7 @@ impl RTCDataChannelMethods for RTCDataChannel { self.id } + // https://www.w3.org/TR/webrtc/#dom-datachannel-readystate fn ReadyState(&self) -> RTCDataChannelState { *self.ready_state.borrow() } |