Changeset 148968 in webkit
- Timestamp:
- Apr 23, 2013 8:53:15 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148965 r148968 1 2013-04-23 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 WebSocket: Return type of send() should be void if hybi-10 protocol is chosen 4 https://bugs.webkit.org/show_bug.cgi?id=65850 5 6 Reviewed by Alexey Proskuryakov. 7 8 Update tests and test results because WebSocket.send() now returns undefined when 9 the hybi WebSocket protocol is used. 10 11 * http/tests/websocket/tests/hybi/bufferedAmount-after-close-expected.txt: 12 * http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy-expected.txt: 13 * http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy.html: 14 * http/tests/websocket/tests/hybi/bufferedAmount-after-close.html: 15 * http/tests/websocket/tests/hybi/send-after-close-on-unload-expected.txt: 16 * http/tests/websocket/tests/hybi/send-after-close-on-unload.html: 17 1 18 2013-04-23 Andreas Kling <akling@apple.com> 2 19 -
trunk/LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close-expected.txt
r94482 r148968 8 8 PASS ws.bufferedAmount is 0 9 9 Testing send(string)... 10 PASS ws.send(messageToSend) is false10 PASS ws.send(messageToSend) is undefined. 11 11 PASS bufferedAmountDifference is 27 12 PASS ws.send(messageToSend) is false12 PASS ws.send(messageToSend) is undefined. 13 13 PASS bufferedAmountDifference is 6 14 PASS ws.send(messageToSend) is false14 PASS ws.send(messageToSend) is undefined. 15 15 PASS bufferedAmountDifference is 7 16 PASS ws.send(messageToSend) is false16 PASS ws.send(messageToSend) is undefined. 17 17 PASS bufferedAmountDifference is 131 18 PASS ws.send(messageToSend) is false18 PASS ws.send(messageToSend) is undefined. 19 19 PASS bufferedAmountDifference is 134 20 PASS ws.send(messageToSend) is false20 PASS ws.send(messageToSend) is undefined. 21 21 PASS bufferedAmountDifference is 65543 22 PASS ws.send(messageToSend) is false22 PASS ws.send(messageToSend) is undefined. 23 23 PASS bufferedAmountDifference is 65550 24 24 Testing send(ArrayBuffer)... 25 PASS ws.send(messageToSend) is false25 PASS ws.send(messageToSend) is undefined. 26 26 PASS bufferedAmountDifference is 6 27 PASS ws.send(messageToSend) is false27 PASS ws.send(messageToSend) is undefined. 28 28 PASS bufferedAmountDifference is 7 29 PASS ws.send(messageToSend) is false29 PASS ws.send(messageToSend) is undefined. 30 30 PASS bufferedAmountDifference is 131 31 PASS ws.send(messageToSend) is false31 PASS ws.send(messageToSend) is undefined. 32 32 PASS bufferedAmountDifference is 134 33 PASS ws.send(messageToSend) is false33 PASS ws.send(messageToSend) is undefined. 34 34 PASS bufferedAmountDifference is 65543 35 PASS ws.send(messageToSend) is false35 PASS ws.send(messageToSend) is undefined. 36 36 PASS bufferedAmountDifference is 65550 37 37 Testing send(Blob)... 38 PASS ws.send(messageToSend) is false38 PASS ws.send(messageToSend) is undefined. 39 39 PASS bufferedAmountDifference is 6 40 PASS ws.send(messageToSend) is false40 PASS ws.send(messageToSend) is undefined. 41 41 PASS bufferedAmountDifference is 7 42 PASS ws.send(messageToSend) is false42 PASS ws.send(messageToSend) is undefined. 43 43 PASS bufferedAmountDifference is 131 44 PASS ws.send(messageToSend) is false44 PASS ws.send(messageToSend) is undefined. 45 45 PASS bufferedAmountDifference is 134 46 PASS ws.send(messageToSend) is false46 PASS ws.send(messageToSend) is undefined. 47 47 PASS bufferedAmountDifference is 65543 48 PASS ws.send(messageToSend) is false48 PASS ws.send(messageToSend) is undefined. 49 49 PASS bufferedAmountDifference is 65550 50 50 PASS successfullyParsed is true -
trunk/LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy-expected.txt
r101730 r148968 9 9 PASS ws.bufferedAmount <= bufferedAmountAfterClose is true 10 10 Testing send(string)... 11 PASS ws.send(messageToSend) is false11 PASS ws.send(messageToSend) is undefined. 12 12 PASS bufferedAmountDifference is 27 13 PASS ws.send(messageToSend) is false13 PASS ws.send(messageToSend) is undefined. 14 14 PASS bufferedAmountDifference is 6 15 PASS ws.send(messageToSend) is false15 PASS ws.send(messageToSend) is undefined. 16 16 PASS bufferedAmountDifference is 7 17 PASS ws.send(messageToSend) is false17 PASS ws.send(messageToSend) is undefined. 18 18 PASS bufferedAmountDifference is 131 19 PASS ws.send(messageToSend) is false19 PASS ws.send(messageToSend) is undefined. 20 20 PASS bufferedAmountDifference is 134 21 PASS ws.send(messageToSend) is false21 PASS ws.send(messageToSend) is undefined. 22 22 PASS bufferedAmountDifference is 65543 23 PASS ws.send(messageToSend) is false23 PASS ws.send(messageToSend) is undefined. 24 24 PASS bufferedAmountDifference is 65550 25 25 Testing send(ArrayBuffer)... 26 PASS ws.send(messageToSend) is false26 PASS ws.send(messageToSend) is undefined. 27 27 PASS bufferedAmountDifference is 6 28 PASS ws.send(messageToSend) is false28 PASS ws.send(messageToSend) is undefined. 29 29 PASS bufferedAmountDifference is 7 30 PASS ws.send(messageToSend) is false30 PASS ws.send(messageToSend) is undefined. 31 31 PASS bufferedAmountDifference is 131 32 PASS ws.send(messageToSend) is false32 PASS ws.send(messageToSend) is undefined. 33 33 PASS bufferedAmountDifference is 134 34 PASS ws.send(messageToSend) is false34 PASS ws.send(messageToSend) is undefined. 35 35 PASS bufferedAmountDifference is 65543 36 PASS ws.send(messageToSend) is false36 PASS ws.send(messageToSend) is undefined. 37 37 PASS bufferedAmountDifference is 65550 38 38 Testing send(Blob)... 39 PASS ws.send(messageToSend) is false39 PASS ws.send(messageToSend) is undefined. 40 40 PASS bufferedAmountDifference is 6 41 PASS ws.send(messageToSend) is false41 PASS ws.send(messageToSend) is undefined. 42 42 PASS bufferedAmountDifference is 7 43 PASS ws.send(messageToSend) is false43 PASS ws.send(messageToSend) is undefined. 44 44 PASS bufferedAmountDifference is 131 45 PASS ws.send(messageToSend) is false45 PASS ws.send(messageToSend) is undefined. 46 46 PASS bufferedAmountDifference is 134 47 PASS ws.send(messageToSend) is false47 PASS ws.send(messageToSend) is undefined. 48 48 PASS bufferedAmountDifference is 65543 49 PASS ws.send(messageToSend) is false49 PASS ws.send(messageToSend) is undefined. 50 50 PASS bufferedAmountDifference is 65550 51 51 PASS successfullyParsed is true -
trunk/LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close-in-busy.html
r122256 r148968 97 97 messageToSend = message; 98 98 var bufferedAmountBeforeSend = ws.bufferedAmount; 99 shouldBe False("ws.send(messageToSend)");99 shouldBeUndefined("ws.send(messageToSend)"); 100 100 var bufferedAmountAfterSend = ws.bufferedAmount; 101 101 bufferedAmountDifference = bufferedAmountAfterSend - bufferedAmountBeforeSend; -
trunk/LayoutTests/http/tests/websocket/tests/hybi/bufferedAmount-after-close.html
r122256 r148968 78 78 messageToSend = message; 79 79 var bufferedAmountBeforeSend = ws.bufferedAmount; 80 shouldBe False("ws.send(messageToSend)");80 shouldBeUndefined("ws.send(messageToSend)"); 81 81 var bufferedAmountAfterSend = ws.bufferedAmount; 82 82 bufferedAmountDifference = bufferedAmountAfterSend - bufferedAmountBeforeSend; -
trunk/LayoutTests/http/tests/websocket/tests/hybi/send-after-close-on-unload-expected.txt
r90726 r148968 7 7 PASS document.childWebSocket is non-null. 8 8 PASS 'socket1' is sent to the server. unload the iframe. expect receiving 'socket1' on ws... 9 PASS document.childWebSocket.send('send to closed socket') is false9 PASS document.childWebSocket.send('send to closed socket') is undefined. 10 10 PASS closedSocket is "socket1" 11 11 PASS document.childWebSocket.readyState is 3 -
trunk/LayoutTests/http/tests/websocket/tests/hybi/send-after-close-on-unload.html
r122256 r148968 42 42 debug("PASS 'socket1' is sent to the server. unload the iframe. expect receiving 'socket1' on ws..."); 43 43 document.body.removeChild(frameDiv); 44 shouldBe False("document.childWebSocket.send('send to closed socket')");44 shouldBeUndefined("document.childWebSocket.send('send to closed socket')"); 45 45 }; 46 46 -
trunk/Source/WebCore/ChangeLog
r148967 r148968 1 2013-04-23 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 WebSocket: Return type of send() should be void if hybi-10 protocol is chosen 4 https://bugs.webkit.org/show_bug.cgi?id=65850 5 6 Reviewed by Alexey Proskuryakov. 7 8 WebSocket API draft changed the return type of send() from boolean to void based on Simon 9 Pieters' post to WHATWG. Firefox 8 and IE 10 already follow the specification, hence it should 10 make sense for us to do the same when hybi protocol is used. 11 12 Original patch by Yuta Kitamura <yutak@chromium.org> 13 14 Tests: http/tests/websocket/tests/hybi/bufferedAmount-after-close.html (updated) 15 http/tests/websocket/tests/hybi/send-after-close-on-unload.html (updated) 16 17 * Modules/websockets/WebSocket.cpp: 18 (WebCore::WebSocket::send): 19 * Modules/websockets/WebSocket.h: 20 * Modules/websockets/WebSocket.idl: 21 1 22 2013-04-23 Carlos Garcia Campos <cgarcia@igalia.com> 2 23 -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r148373 r148968 292 292 } 293 293 294 boolWebSocket::send(const String& message, ExceptionCode& ec)294 void WebSocket::send(const String& message, ExceptionCode& ec) 295 295 { 296 296 LOG(Network, "WebSocket %p send() Sending String '%s'", this, message.utf8().data()); 297 297 if (m_state == CONNECTING) { 298 298 ec = INVALID_STATE_ERR; 299 return false;299 return; 300 300 } 301 301 // No exception is raised if the connection was once established but has subsequently been closed. … … 304 304 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize); 305 305 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize)); 306 return false;306 return; 307 307 } 308 308 ASSERT(m_channel); … … 311 311 scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Websocket message contains invalid character(s)."); 312 312 ec = SYNTAX_ERR; 313 return false; 314 } 315 return result == ThreadableWebSocketChannel::SendSuccess; 316 } 317 318 bool WebSocket::send(ArrayBuffer* binaryData, ExceptionCode& ec) 313 return; 314 } 315 } 316 317 void WebSocket::send(ArrayBuffer* binaryData, ExceptionCode& ec) 319 318 { 320 319 LOG(Network, "WebSocket %p send() Sending ArrayBuffer %p", this, binaryData); … … 322 321 if (m_state == CONNECTING) { 323 322 ec = INVALID_STATE_ERR; 324 return false;323 return; 325 324 } 326 325 if (m_state == CLOSING || m_state == CLOSED) { … … 328 327 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize); 329 328 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize)); 330 return false;329 return; 331 330 } 332 331 ASSERT(m_channel); 333 return m_channel->send(*binaryData, 0, binaryData->byteLength()) == ThreadableWebSocketChannel::SendSuccess;334 } 335 336 boolWebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec)332 m_channel->send(*binaryData, 0, binaryData->byteLength()); 333 } 334 335 void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionCode& ec) 337 336 { 338 337 LOG(Network, "WebSocket %p send() Sending ArrayBufferView %p", this, arrayBufferView); … … 340 339 if (m_state == CONNECTING) { 341 340 ec = INVALID_STATE_ERR; 342 return false;341 return; 343 342 } 344 343 if (m_state == CLOSING || m_state == CLOSED) { … … 346 345 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize); 347 346 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize)); 348 return false;347 return; 349 348 } 350 349 ASSERT(m_channel); 351 350 RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->buffer()); 352 return m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength()) == ThreadableWebSocketChannel::SendSuccess;353 } 354 355 boolWebSocket::send(Blob* binaryData, ExceptionCode& ec)351 m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength()); 352 } 353 354 void WebSocket::send(Blob* binaryData, ExceptionCode& ec) 356 355 { 357 356 LOG(Network, "WebSocket %p send() Sending Blob '%s'", this, binaryData->url().elidedString().utf8().data()); … … 359 358 if (m_state == CONNECTING) { 360 359 ec = INVALID_STATE_ERR; 361 return false;360 return; 362 361 } 363 362 if (m_state == CLOSING || m_state == CLOSED) { … … 365 364 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, payloadSize); 366 365 m_bufferedAmountAfterClose = saturateAdd(m_bufferedAmountAfterClose, getFramingOverhead(payloadSize)); 367 return false;366 return; 368 367 } 369 368 ASSERT(m_channel); 370 return m_channel->send(*binaryData) == ThreadableWebSocketChannel::SendSuccess;369 m_channel->send(*binaryData); 371 370 } 372 371 -
trunk/Source/WebCore/Modules/websockets/WebSocket.h
r134221 r148968 73 73 void connect(const String& url, const Vector<String>& protocols, ExceptionCode&); 74 74 75 boolsend(const String& message, ExceptionCode&);76 boolsend(ArrayBuffer*, ExceptionCode&);77 boolsend(ArrayBufferView*, ExceptionCode&);78 boolsend(Blob*, ExceptionCode&);75 void send(const String& message, ExceptionCode&); 76 void send(ArrayBuffer*, ExceptionCode&); 77 void send(ArrayBufferView*, ExceptionCode&); 78 void send(Blob*, ExceptionCode&); 79 79 80 80 void close(int code, const String& reason, ExceptionCode&); -
trunk/Source/WebCore/Modules/websockets/WebSocket.idl
r138138 r148968 65 65 attribute DOMString binaryType; 66 66 67 booleansend(in ArrayBuffer data)67 void send(in ArrayBuffer data) 68 68 raises(DOMException); 69 booleansend(in ArrayBufferView data)69 void send(in ArrayBufferView data) 70 70 raises(DOMException); 71 booleansend(in Blob data)71 void send(in Blob data) 72 72 raises(DOMException); 73 booleansend(in DOMString data)73 void send(in DOMString data) 74 74 raises(DOMException); 75 75
Note: See TracChangeset
for help on using the changeset viewer.