Cleanups and tidy fixes

This commit is contained in:
Fernando Jiménez Moreno 2020-06-02 10:52:34 +02:00
parent ace0d7795e
commit 960b010d30
8 changed files with 23 additions and 24 deletions

View file

@ -282,26 +282,26 @@ impl RTCDataChannelMethods for RTCDataChannel {
// fn SetBufferedAmountLowThreshold(&self, value: u32) -> (); // fn SetBufferedAmountLowThreshold(&self, value: u32) -> ();
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-close // https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-close
fn Close(&self) -> () {} fn Close(&self) {}
// fn BinaryType(&self) -> DOMString; // fn BinaryType(&self) -> DOMString;
// fn SetBinaryType(&self, value: DOMString) -> (); // fn SetBinaryType(&self, value: DOMString) -> ();
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send // https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send
fn Send(&self, data: USVString) -> () { fn Send(&self, data: USVString) {
if let Err(error) = self.channel.send(&data.0) { if let Err(error) = self.channel.send(&data.0) {
warn!("Could not send data channel message. Error: {:?}", error); warn!("Could not send data channel message. Error: {:?}", error);
} }
} }
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-1 // https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-1
fn Send_(&self, data: &Blob) -> () {} // fn Send_(&self, data: &Blob) -> () {}
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-2 // https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-2
fn Send__(&self, data: CustomAutoRooterGuard<ArrayBuffer>) -> () {} // fn Send__(&self, data: CustomAutoRooterGuard<ArrayBuffer>) -> () {}
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-3 // https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-send!overload-3
fn Send___(&self, data: CustomAutoRooterGuard<ArrayBufferView>) -> () {} // fn Send___(&self, data: CustomAutoRooterGuard<ArrayBufferView>) -> () {}
} }
impl From<&RTCDataChannelInit> for WebRtcDataChannelInit { impl From<&RTCDataChannelInit> for WebRtcDataChannelInit {

View file

@ -48,6 +48,7 @@ impl RTCDataChannelEvent {
event event
} }
#[allow(non_snake_case)]
pub fn Constructor( pub fn Constructor(
window: &Window, window: &Window,
type_: DOMString, type_: DOMString,
@ -64,10 +65,12 @@ impl RTCDataChannelEvent {
} }
impl RTCDataChannelEventMethods for RTCDataChannelEvent { impl RTCDataChannelEventMethods for RTCDataChannelEvent {
// https://www.w3.org/TR/webrtc/#dom-datachannelevent-channel
fn Channel(&self) -> DomRoot<RTCDataChannel> { fn Channel(&self) -> DomRoot<RTCDataChannel> {
DomRoot::from_ref(&*self.channel) DomRoot::from_ref(&*self.channel)
} }
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool { fn IsTrusted(&self) -> bool {
self.event.IsTrusted() self.event.IsTrusted()
} }

View file

@ -62,10 +62,12 @@ impl RTCErrorEvent {
} }
impl RTCErrorEventMethods for RTCErrorEvent { impl RTCErrorEventMethods for RTCErrorEvent {
// https://www.w3.org/TR/webrtc/#dom-rtcerrorevent-error
fn Error(&self) -> DomRoot<RTCError> { fn Error(&self) -> DomRoot<RTCError> {
DomRoot::from_ref(&*self.error) DomRoot::from_ref(&*self.error)
} }
// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool { fn IsTrusted(&self) -> bool {
self.event.IsTrusted() self.event.IsTrusted()
} }

View file

@ -675,15 +675,9 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
fn CreateDataChannel( fn CreateDataChannel(
&self, &self,
label: USVString, label: USVString,
dataChannelDict: &RTCDataChannelInit, init: &RTCDataChannelInit,
) -> DomRoot<RTCDataChannel> { ) -> DomRoot<RTCDataChannel> {
RTCDataChannel::new( RTCDataChannel::new(&self.global(), &self.controller, label, init, None)
&self.global(),
&self.controller,
label,
dataChannelDict,
None,
)
} }
} }

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel // https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel
[Exposed=Window] [Exposed=Window]
interface RTCDataChannel : EventTarget { interface RTCDataChannel : EventTarget {
@ -25,9 +25,9 @@ interface RTCDataChannel : EventTarget {
attribute EventHandler onmessage; attribute EventHandler onmessage;
//attribute DOMString binaryType; //attribute DOMString binaryType;
void send(USVString data); void send(USVString data);
void send(Blob data); //void send(Blob data);
void send(ArrayBuffer data); //void send(ArrayBuffer data);
void send(ArrayBufferView data); //void send(ArrayBufferView data);
}; };
// https://www.w3.org/TR/webrtc/#dom-rtcdatachannelinit // https://www.w3.org/TR/webrtc/#dom-rtcdatachannelinit

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.w3.org/TR/webrtc/#rtcdatachannelevent // https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelevent
[Exposed=Window] [Exposed=Window]
interface RTCDataChannelEvent : Event { interface RTCDataChannelEvent : Event {

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.w3.org/TR/webrtc/#dom-rtcerror // https://w3c.github.io/webrtc-pc/#dom-rtcerror
[Exposed=Window] [Exposed=Window]
interface RTCError : DOMException { interface RTCError : DOMException {

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://www.w3.org/TR/webrtc/#rtcerrorevent-interface // https://w3c.github.io/webrtc-pc/#dom-rtcerrorevent
[Exposed=Window] [Exposed=Window]
interface RTCErrorEvent : Event { interface RTCErrorEvent : Event {