diff --git a/components/script/dom/rtcicecandidate.rs b/components/script/dom/rtcicecandidate.rs index 144ac9f7413..9eefcd35134 100644 --- a/components/script/dom/rtcicecandidate.rs +++ b/components/script/dom/rtcicecandidate.rs @@ -98,4 +98,14 @@ impl RTCIceCandidateMethods for RTCIceCandidate { fn GetUsernameFragment(&self) -> Option { self.username_fragment.clone() } + + /// https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson + fn ToJSON(&self) -> RTCIceCandidateInit { + RTCIceCandidateInit { + candidate: self.candidate.clone(), + sdpMid: self.sdp_m_id.clone(), + sdpMLineIndex: self.sdp_m_line_index.clone(), + usernameFragment: self.username_fragment.clone(), + } + } } diff --git a/components/script/dom/webidls/RTCIceCandidate.webidl b/components/script/dom/webidls/RTCIceCandidate.webidl index 3d0fdb006c7..538805c88db 100644 --- a/components/script/dom/webidls/RTCIceCandidate.webidl +++ b/components/script/dom/webidls/RTCIceCandidate.webidl @@ -22,7 +22,7 @@ interface RTCIceCandidate { // readonly attribute DOMString? relatedAddress; // readonly attribute unsigned short? relatedPort; readonly attribute DOMString? usernameFragment; - // RTCIceCandidateInit toJSON(); + RTCIceCandidateInit toJSON(); }; dictionary RTCIceCandidateInit {