bug 674890 - Update WebSocket API to latest draft - send() should return void r=sicking sr=bz
authorPatrick McManus <mcmanus@ducksong.com>
Tue, 02 Aug 2011 15:35:45 -0400
changeset 73719 d5ada3bd3ad523be240f3f82a8983f2a8a6bfa29
parent 73718 0b15ed31ebc21821222fe54c67917604476ac741
child 73720 da90e2e9a56ea3e9d8c821cc38db075d3fc5e1e5
push id20911
push usermak77@bonardo.net
push dateWed, 03 Aug 2011 08:47:10 +0000
treeherdermozilla-central@c35c69e1ce99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, bz
bugs674890
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 674890 - Update WebSocket API to latest draft - send() should return void r=sicking sr=bz
content/base/public/nsIMozWebSocket.idl
content/base/src/nsWebSocket.cpp
--- a/content/base/public/nsIMozWebSocket.idl
+++ b/content/base/public/nsIMozWebSocket.idl
@@ -46,17 +46,17 @@ interface nsPIDOMWindow;
 
 /**
  * The nsIMozWebSocket interface enables Web applications to maintain
  * bidirectional communications with server-side processes as described in:
  *
  * http://dev.w3.org/html5/websockets/
  *
  */
-[scriptable, uuid(eae76132-e4a4-4765-8494-5e136521c846)]
+[scriptable, uuid(662691db-2b99-4461-801b-fbb72d99a4b9)]
 interface nsIMozWebSocket : nsISupports
 {
   readonly attribute DOMString url;
   readonly attribute DOMString protocol;
 
   //ready state
   const unsigned short CONNECTING = 0;
   const unsigned short OPEN = 1;
@@ -74,17 +74,17 @@ interface nsIMozWebSocket : nsISupports
 
   /**
    * Transmits data using the connection.
    *
    * @param data The data to be transmited.
    * @return if the connection is still established (and the data was queued or
    *         sent successfully).
    */
-  boolean send(in DOMString data);
+  void send(in DOMString data);
 
   /**
    * Closes the Web Socket connection or connection attempt, if any.
    * If the connection is already closed, it does nothing.
    */
   void close();
 
   /**
--- a/content/base/src/nsWebSocket.cpp
+++ b/content/base/src/nsWebSocket.cpp
@@ -1231,20 +1231,19 @@ nsWebSocket::GetBufferedAmount(PRUint32 
   }
 
 NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(open, mOnOpenListener)
 NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(error, mOnErrorListener)
 NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(message, mOnMessageListener)
 NS_WEBSOCKET_IMPL_DOMEVENTLISTENER(close, mOnCloseListener)
 
 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");
-  *aRet = PR_FALSE;
 
   if (mReadyState == nsIMozWebSocket::CONNECTING) {
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
   // Check for unpaired surrogates.
   PRUint32 i, length = aData.Length();
   for (i = 0; i < length; ++i) {
@@ -1261,18 +1260,17 @@ nsWebSocket::Send(const nsAString& aData
   }
 
   if (mReadyState == nsIMozWebSocket::CLOSING ||
       mReadyState == nsIMozWebSocket::CLOSED) {
     mOutgoingBufferedAmount += NS_ConvertUTF16toUTF8(aData).Length();
     return NS_OK;
   }
 
-  nsresult rv = mConnection->PostMessage(PromiseFlatString(aData));
-  *aRet = NS_SUCCEEDED(rv);
+  mConnection->PostMessage(PromiseFlatString(aData));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWebSocket::Close()
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");