Chromium Code Reviews| Index: ppapi/api/dev/ppb_websocket_dev.idl |
| diff --git a/ppapi/api/dev/ppb_websocket_dev.idl b/ppapi/api/dev/ppb_websocket_dev.idl |
| index 6dd0bd86c08de14cdefa5cdfb46252473980fdd4..374657ce3cc4792d194e62711f63ef654ff54b8d 100644 |
| --- a/ppapi/api/dev/ppb_websocket_dev.idl |
| +++ b/ppapi/api/dev/ppb_websocket_dev.idl |
| @@ -110,14 +110,22 @@ interface PPB_WebSocket_Dev { |
| * <code>protocols</code>. |
| * |
| * @param[in] callback A <code>PP_CompletionCallback</code> which is called |
| - * when the connection is established or an error occurs in establishing |
| + * when a connection is established or an error occurs in establishing |
| * connection. |
| * |
| - * @return In case of immediate failure, returns an error code as follows. |
| - * Returns <code>PP_ERROR_BADARGUMENT</code> corresponding to JavaScript |
| - * SyntaxError and <code>PP_ERROR_NOACCESS</code> corresponding to JavaScript |
| - * SecurityError. Otherwise, returns <code>PP_OK_COMPLETIONPENDING</code> |
| - * and invokes <code>callback</code> later. |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + * Returns <code>PP_ERROR_BADARGUMENT</code> if specified <code>url</code>, |
| + * or <code>protocols</code> contains invalid string as |
| + * <code>The WebSocket API specification</code> defines. It corresponds to |
| + * SyntaxError of the specification. |
| + * Returns <code>PP_ERROR_NOACCESS</code> if the protocol specified in the |
| + * <code>url</code> is not secure protocol, but the origin of the caller |
|
dmichael (off chromium)
2011/12/16 03:04:29
nit: "not secure" -> "not a secure"
Takashi Toyoshima
2011/12/16 05:36:38
Done.
|
| + * has a secure scheme. Also returns it if the port specified in the |
| + * <code>url</code> is a port to which the user agent is configured to block |
| + * access because the port is well-known ports like SMTP, or so. It |
|
dmichael (off chromium)
2011/12/16 03:04:29
nit: "is well"->"is a well"
nit: "ports"->"port"
n
Takashi Toyoshima
2011/12/16 05:36:38
Done.
|
| + * corresponds to SecurityError of the specification. |
| + * Returns <code>PP_ERROR_INPROGRESS</code> if the call is not the first |
| + * time. |
| */ |
| int32_t Connect([in] PP_Resource web_socket, |
| [in] PP_Var url, |
| @@ -140,14 +148,17 @@ interface PPB_WebSocket_Dev { |
| * <code>PP_VARTYPE_STRING</code>. |
| * |
| * @param[in] callback A <code>PP_CompletionCallback</code> which is called |
| - * when the connection is closed or an error occurs in closing connection. |
| - * |
| - * @return In case of immediate failure, returns an error code as follows. |
| - * Returns <code>PP_ERROR_BADARGUMENT</code> corresponding to JavaScript |
| - * SyntaxError and <code>PP_ERROR_NOACCESS</code> corresponding to JavaScript |
| - * InvalidAccessError. Otherwise, returns |
| - * <code>PP_OK_COMPLETIONPENDING</code> and invokes <code>callback</code> |
| - * later. |
| + * when the connection is closed or an error occurs in closing the |
| + * connection. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + * Returns <code>PP_ERROR_BADARGUMENT</code> if <code>reason</code> contains |
| + * an invalid character as a UTF-8 string, or longer than 123 bytes. It |
| + * corresponds to JavaScript SyntaxError of the specification. |
| + * Returns <code>PP_ERROR_NOACCESS</code> if the code is not an integer |
| + * equal to 1000 or in the range 3000 to 4999. It corresponds to |
| + * InvalidAccessError of the specification. Returns |
| + * <code>PP_ERROR_INPROGRESS</code> if the call is not the first time. |
| */ |
| int32_t Close([in] PP_Resource web_socket, |
| [in] uint16_t code, |
| @@ -156,27 +167,26 @@ interface PPB_WebSocket_Dev { |
| /** |
| * ReceiveMessage() receives a message from the WebSocket server. |
| - * This interface only returns bytes of a single message. That is, this |
| - * interface must be called at least N times to receive N messages, no matter |
| - * how small each message is. |
| + * This interface only returns a single message. That is, this interface must |
| + * be called at least N times to receive N messages, no matter how small each |
| + * message is. |
| * |
| * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| * WebSocket. |
| * |
| * @param[out] message The received message is copied to provided |
| - * <code>message</code>. |
| + * <code>message</code>. The <code>message</code> must remain valid until |
| + * the ReceiveMessage operation completes. |
| * |
| * @param[in] callback A <code>PP_CompletionCallback</code> which is called |
| - * when the receiving message is completed. It is ignored when the function |
| - * return <code>PP_OK</code>. |
| - * |
| - * @return In case of immediate failure, returns |
| - * <code>PP_ERROR_FAILED</code>. If a message is currently available, returns |
| - * <code>PP_OK</code>. Otherwise, returns <PP_OK_COMPLETIONPENDING</code> |
| - * and invokes <code>callback</code> later. At that case, if GetReadyState() |
| - * returns <code>PP_WEBSOCKETREADYSTATE_OPEN</code>, the received |
| - * message is also copied to procided <code>message</code>. Otherwise, |
| - * the connection is closed and ReceiveMessage() failed to receive a message. |
| + * when the receiving message is completed. It is ignored if ReceiveMessage |
| + * completes synchronously and returns <code>PP_OK</code>. |
| + * |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + * If an error is detected or connection is closed, returns |
| + * <code>PP_ERROR_FAILED</code> after all buffered messages are received. |
| + * Until buffered message become empty, continues to returns |
| + * <code>PP_OK</code> as if connection is still established without errors. |
| */ |
| int32_t ReceiveMessage([in] PP_Resource web_socket, |
| [out] PP_Var message, |
| @@ -192,12 +202,15 @@ interface PPB_WebSocket_Dev { |
| * buffer. So caller can free <code>message</code> safely after returning |
| * from the function. |
| * |
| - * @return In case of immediate failure, returns an error code as follows. |
| - * Returns <code>PP_ERROR_FAILED</code> corresponding to JavaScript |
| - * InvalidStateError and <code>PP_ERROR_BADARGUMENT</code> corresponding to |
| - * JavaScript SyntaxError. Otherwise, return <code>PP_OK</code>. |
| - * <code>PP_OK</code> doesn't necessarily mean that the server received the |
| - * message. |
| + * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| + * Returns <code>PP_ERROR_FAILED</code> if the ReadyState is |
| + * <code>PP_WEBSOCKETREADYSTATE_CONNECTING_DEV</code>. It corresponds |
| + * JavaScript InvalidStateError of the specification. |
| + * Returns <code>PP_ERROR_BADARGUMENT</code> if provided <code>message</code> |
| + * of string type contains an invalid character as a UTF-8 string. It |
| + * corresponds to JavaScript SyntaxError of the specification. |
| + * Otherwise, returns <code>PP_OK</code>, but it doesn't necessarily mean |
| + * that the server received the message. |
| */ |
| int32_t SendMessage([in] PP_Resource web_socket, |
| [in] PP_Var message); |
| @@ -207,10 +220,6 @@ interface PPB_WebSocket_Dev { |
| * messages that have been queued for the WebSocket connection to send but |
| * have not been transmitted to the network yet. |
| * |
| - * Note: This interface might not be able to return exact bytes in the first |
| - * release. Current WebSocket implementation can not estimate exact protocol |
| - * frame overheads. |
| - * |
| * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| * WebSocket. |
| * |
| @@ -236,8 +245,8 @@ interface PPB_WebSocket_Dev { |
| * @param[in] web_socket A <code>PP_Resource</code> corresponding to a |
| * WebSocket. |
| * |
| - * @return Returns a <code>PP_VARTYPE_STRING</code> var. if called before the |
| - * close reason is set, its data is empty string. Returns a |
| + * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| + * close reason is set, it contains an empty string. Returns a |
| * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| */ |
| PP_Var GetCloseReason([in] PP_Resource web_socket); |
| @@ -252,7 +261,7 @@ interface PPB_WebSocket_Dev { |
| * @return Returns <code>PP_FALSE</code> if called before the connection is |
| * closed, or called on an invalid resource. Otherwise, returns |
| * <code>PP_TRUE</code> if the connection was closed cleanly, or returns |
| - * <code>PP_FALSE</code> if the connection was closed by abnormal reasons. |
| + * <code>PP_FALSE</code> if the connection was closed for abnormal reasons. |
| */ |
| PP_Bool GetCloseWasClean([in] PP_Resource web_socket); |
| @@ -264,9 +273,9 @@ interface PPB_WebSocket_Dev { |
| * WebSocket. |
| * |
| * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| - * connection is established, its data is empty string. Returns a |
| + * connection is established, its data is an empty string. Returns a |
| * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| - * Currently its data for valid resources are always empty string. |
| + * Currently its data for valid resources are always an empty string. |
| */ |
| PP_Var GetExtensions([in] PP_Resource web_socket); |
| @@ -278,7 +287,7 @@ interface PPB_WebSocket_Dev { |
| * WebSocket. |
| * |
| * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| - * connection is established, its data is empty string. Returns a |
| + * connection is established, it contains the empty string. Returns a |
| * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| */ |
| PP_Var GetProtocol([in] PP_Resource web_socket); |
| @@ -302,7 +311,7 @@ interface PPB_WebSocket_Dev { |
| * WebSocket. |
| * |
| * @return Returns a <code>PP_VARTYPE_STRING</code> var. If called before the |
| - * connection is established, its data is empty string. Return a |
| + * connection is established, it contains the empty string. Return a |
| * <code>PP_VARTYPE_UNDEFINED</code> if called on an invalid resource. |
| */ |
| PP_Var GetURL([in] PP_Resource web_socket); |