Skip to content

Commit

Permalink
Cleanups and tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferjm committed Jun 29, 2020
1 parent ace0d77 commit 960b010
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
10 changes: 5 additions & 5 deletions components/script/dom/rtcdatachannel.rs
Expand Up @@ -282,26 +282,26 @@ impl RTCDataChannelMethods for RTCDataChannel {
// fn SetBufferedAmountLowThreshold(&self, value: u32) -> ();

// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-close
fn Close(&self) -> () {}
fn Close(&self) {}

// fn BinaryType(&self) -> DOMString;
// fn SetBinaryType(&self, value: DOMString) -> ();

// 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) {
warn!("Could not send data channel message. Error: {:?}", error);
}
}

// 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
fn Send__(&self, data: CustomAutoRooterGuard<ArrayBuffer>) -> () {}
// fn Send__(&self, data: CustomAutoRooterGuard<ArrayBuffer>) -> () {}

// 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 {
Expand Down
3 changes: 3 additions & 0 deletions components/script/dom/rtcdatachannelevent.rs
Expand Up @@ -48,6 +48,7 @@ impl RTCDataChannelEvent {
event
}

#[allow(non_snake_case)]
pub fn Constructor(
window: &Window,
type_: DOMString,
Expand All @@ -64,10 +65,12 @@ impl RTCDataChannelEvent {
}

impl RTCDataChannelEventMethods for RTCDataChannelEvent {
// https://www.w3.org/TR/webrtc/#dom-datachannelevent-channel
fn Channel(&self) -> DomRoot<RTCDataChannel> {
DomRoot::from_ref(&*self.channel)
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
Expand Down
2 changes: 2 additions & 0 deletions components/script/dom/rtcerrorevent.rs
Expand Up @@ -62,10 +62,12 @@ impl RTCErrorEvent {
}

impl RTCErrorEventMethods for RTCErrorEvent {
// https://www.w3.org/TR/webrtc/#dom-rtcerrorevent-error
fn Error(&self) -> DomRoot<RTCError> {
DomRoot::from_ref(&*self.error)
}

// https://dom.spec.whatwg.org/#dom-event-istrusted
fn IsTrusted(&self) -> bool {
self.event.IsTrusted()
}
Expand Down
10 changes: 2 additions & 8 deletions components/script/dom/rtcpeerconnection.rs
Expand Up @@ -675,15 +675,9 @@ impl RTCPeerConnectionMethods for RTCPeerConnection {
fn CreateDataChannel(
&self,
label: USVString,
dataChannelDict: &RTCDataChannelInit,
init: &RTCDataChannelInit,
) -> DomRoot<RTCDataChannel> {
RTCDataChannel::new(
&self.global(),
&self.controller,
label,
dataChannelDict,
None,
)
RTCDataChannel::new(&self.global(), &self.controller, label, init, None)
}
}

Expand Down
10 changes: 5 additions & 5 deletions components/script/dom/webidls/RTCDataChannel.webidl
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// https://www.w3.org/TR/webrtc/#dom-rtcdatachannel
// https://w3c.github.io/webrtc-pc/#dom-rtcdatachannel

[Exposed=Window]
interface RTCDataChannel : EventTarget {
Expand All @@ -25,9 +25,9 @@ interface RTCDataChannel : EventTarget {
attribute EventHandler onmessage;
//attribute DOMString binaryType;
void send(USVString data);
void send(Blob data);
void send(ArrayBuffer data);
void send(ArrayBufferView data);
//void send(Blob data);
//void send(ArrayBuffer data);
//void send(ArrayBufferView data);
};

// https://www.w3.org/TR/webrtc/#dom-rtcdatachannelinit
Expand All @@ -46,4 +46,4 @@ enum RTCDataChannelState {
"open",
"closing",
"closed"
};
};
4 changes: 2 additions & 2 deletions components/script/dom/webidls/RTCDataChannelEvent.webidl
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// https://www.w3.org/TR/webrtc/#rtcdatachannelevent
// https://w3c.github.io/webrtc-pc/#dom-rtcdatachannelevent

[Exposed=Window]
interface RTCDataChannelEvent : Event {
Expand All @@ -12,4 +12,4 @@ interface RTCDataChannelEvent : Event {

dictionary RTCDataChannelEventInit : EventInit {
required RTCDataChannel channel;
};
};
4 changes: 2 additions & 2 deletions components/script/dom/webidls/RTCError.webidl
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// https://www.w3.org/TR/webrtc/#dom-rtcerror
// https://w3c.github.io/webrtc-pc/#dom-rtcerror

[Exposed=Window]
interface RTCError : DOMException {
Expand Down Expand Up @@ -32,4 +32,4 @@ enum RTCErrorDetailType {
"sdp-syntax-error",
"hardware-encoder-not-available",
"hardware-encoder-error"
};
};
4 changes: 2 additions & 2 deletions components/script/dom/webidls/RTCErrorEvent.webidl
Expand Up @@ -2,7 +2,7 @@
* 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/. */

// https://www.w3.org/TR/webrtc/#rtcerrorevent-interface
// https://w3c.github.io/webrtc-pc/#dom-rtcerrorevent

[Exposed=Window]
interface RTCErrorEvent : Event {
Expand All @@ -12,4 +12,4 @@ interface RTCErrorEvent : Event {

dictionary RTCErrorEventInit : EventInit {
required RTCError error;
};
};

0 comments on commit 960b010

Please sign in to comment.