bug 674890 - Update WebSocket API to latest draft - send() should return void r=sicking sr=bz

This commit is contained in:
Patrick McManus 2011-08-02 15:35:45 -04:00
Родитель 437bdb3dd5
Коммит 226b80bf51
2 изменённых файлов: 4 добавлений и 6 удалений

Просмотреть файл

@ -51,7 +51,7 @@ interface nsPIDOMWindow;
* http://dev.w3.org/html5/websockets/ * http://dev.w3.org/html5/websockets/
* *
*/ */
[scriptable, uuid(eae76132-e4a4-4765-8494-5e136521c846)] [scriptable, uuid(662691db-2b99-4461-801b-fbb72d99a4b9)]
interface nsIMozWebSocket : nsISupports interface nsIMozWebSocket : nsISupports
{ {
readonly attribute DOMString url; readonly attribute DOMString url;
@ -79,7 +79,7 @@ interface nsIMozWebSocket : nsISupports
* @return if the connection is still established (and the data was queued or * @return if the connection is still established (and the data was queued or
* sent successfully). * sent successfully).
*/ */
boolean send(in DOMString data); void send(in DOMString data);
/** /**
* Closes the Web Socket connection or connection attempt, if any. * Closes the Web Socket connection or connection attempt, if any.

Просмотреть файл

@ -1236,10 +1236,9 @@ NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(message, mOnMessageListener)
NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(close, mOnCloseListener) NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(close, mOnCloseListener)
NS_IMETHODIMP NS_IMETHODIMP
nsWebSocket::Send(const nsAString& aData, PRBool *aRet) nsWebSocket::Send(const nsAString& aData)
{ {
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
*aRet = PR_FALSE;
if (mReadyState == nsIMozWebSocket::CONNECTING) { if (mReadyState == nsIMozWebSocket::CONNECTING) {
return NS_ERROR_DOM_INVALID_STATE_ERR; return NS_ERROR_DOM_INVALID_STATE_ERR;
@ -1266,8 +1265,7 @@ nsWebSocket::Send(const nsAString& aData, PRBool *aRet)
return NS_OK; return NS_OK;
} }
nsresult rv = mConnection->PostMessage(PromiseFlatString(aData)); mConnection->PostMessage(PromiseFlatString(aData));
*aRet = NS_SUCCEEDED(rv);
return NS_OK; return NS_OK;
} }