[Bug 25102] RTCDataChannel::send() steps are not proper.

https://www.w3.org/Bugs/Public/show_bug.cgi?id=25102

--- Comment #3 from Adam Bergkvist <adam.bergkvist@ericsson.com> ---
(In reply to Kiran from comment #2)
> After reading the websocket spec, the following is my understanding,
> 
> 1. websocket spec has not explicitly specified what whether to raise an
> exception or not if the connections ready state is closing or closed. But in
> general case, socket APIs will raise exceptions if the sockets are close.

The fact the spec (WebSocket.send()) doesn't say that an exception should be
raised if the readyState is closing or closed means that there must be no such
exceptions at that time.

> 2. It is specified that bufferedAmount attribute must be increased only if
> there is no exception.
> 
> "Any invocation of this method with a string argument that does not throw an
> exception must increase the bufferedAmount attribute by the number of bytes
> needed to express the argument as UTF-8"

Yes. We don't have that clarifying paragraph (I think), but the
DataChannel.send() algorithm specifies how bufferedAmount is increased.

> In datachannel case, spec is specifying to abort the steps if readystate is
> "closing" or "closed". Generally implementations will raise any exception in
> this case.

DataChannel.send() is imitating WebSocket.send() when it comes to exceptions so
it's intentionally not raising an exception on "closing" or "closed". Sending
data on a DataChannel that has closed will simply increase the bufferedAmount
like WebSocket do. You will off course get notified with an event when the
DataChannel closes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

Received on Thursday, 12 June 2014 05:15:00 UTC