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

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

--- Comment #2 from Kiran <kiran.guduru@samsung.com> ---
(In reply to Adam Bergkvist from comment #1)
> We imitate WebSocket here and don't throw unless the channel is connecting
> [1]. Calling send() on a closed DataChannel will simply increase the
> buffered amount since nothing is sent.
> 
> [1] http://dev.w3.org/html5/websockets/#dom-websocket-send

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.

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"

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.

So, it seems it is better to move this state prior to that of increasing the
buffered amount, like.

"If channel’s readyState attribute is connecting or closing or closed, throw an
InvalidStateError exception and abort these steps"

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

Received on Wednesday, 11 June 2014 15:28:17 UTC