diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2020-05-30 21:51:17 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2020-06-29 16:53:47 +0200 |
commit | 4e6d3e7cec0fa2467bdb7e6dd926facc4c37a28b (patch) | |
tree | c263ebdc9d97478c665443b8b438bf7026a8516b /components/script/dom/rtcpeerconnection.rs | |
parent | 5788882b16a30fee81c75ab26b7f6c8555b43693 (diff) | |
download | servo-4e6d3e7cec0fa2467bdb7e6dd926facc4c37a28b.tar.gz servo-4e6d3e7cec0fa2467bdb7e6dd926facc4c37a28b.zip |
WebRTCDataChannel initial support
Diffstat (limited to 'components/script/dom/rtcpeerconnection.rs')
-rw-r--r-- | components/script/dom/rtcpeerconnection.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs index fa8c5dda800..5ce0b109bbd 100644 --- a/components/script/dom/rtcpeerconnection.rs +++ b/components/script/dom/rtcpeerconnection.rs @@ -3,6 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; +use crate::dom::bindings::codegen::Bindings::RTCDataChannelBinding::RTCDataChannelInit; use crate::dom::bindings::codegen::Bindings::RTCIceCandidateBinding::RTCIceCandidateInit; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::RTCPeerConnectionMethods; use crate::dom::bindings::codegen::Bindings::RTCPeerConnectionBinding::{ @@ -20,12 +21,14 @@ use crate::dom::bindings::refcounted::{Trusted, TrustedPromise}; use crate::dom::bindings::reflector::reflect_dom_object; use crate::dom::bindings::reflector::DomObject; use crate::dom::bindings::root::{DomRoot, MutNullableDom}; +use crate::dom::bindings::str::USVString; use crate::dom::event::{Event, EventBubbles, EventCancelable}; use crate::dom::eventtarget::EventTarget; use crate::dom::globalscope::GlobalScope; use crate::dom::mediastream::MediaStream; use crate::dom::mediastreamtrack::MediaStreamTrack; use crate::dom::promise::Promise; +use crate::dom::rtcdatachannel::RTCDataChannel; use crate::dom::rtcicecandidate::RTCIceCandidate; use crate::dom::rtcpeerconnectioniceevent::RTCPeerConnectionIceEvent; use crate::dom::rtcsessiondescription::RTCSessionDescription; @@ -448,6 +451,9 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { SetOnsignalingstatechange ); + // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-ondatachannel + event_handler!(datachannel, GetOndatachannel, SetOndatachannel); + /// https://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addicecandidate fn AddIceCandidate(&self, candidate: &RTCIceCandidateInit, comp: InRealm) -> Rc<Promise> { let p = Promise::new_in_current_realm(&self.global(), comp); @@ -633,6 +639,15 @@ impl RTCPeerConnectionMethods for RTCPeerConnection { // Step 11 // (no current support for connection state) } + + /// https://www.w3.org/TR/webrtc/#dom-peerconnection-createdatachannel + fn CreateDataChannel( + &self, + label: USVString, + dataChannelDict: &RTCDataChannelInit, + ) -> DomRoot<RTCDataChannel> { + RTCDataChannel::new(&self.global(), &self.controller, label, dataChannelDict) + } } impl From<SessionDescription> for RTCSessionDescriptionInit { |