diff options
-rw-r--r-- | third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp index 524798b..48cfa5e 100644 --- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp +++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp @@ -446,9 +446,17 @@ void DOMWebSocket::send(Blob* binaryData, ExceptionState& exceptionState) return; } Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", WebSocketSendTypeBlob, WebSocketSendTypeMax); - m_bufferedAmount += binaryData->size(); + unsigned long long size = binaryData->size(); + m_bufferedAmount += size; ASSERT(m_channel); - m_channel->send(binaryData->blobDataHandle()); + + // When the runtime type of |binaryData| is File, + // binaryData->blobDataHandle()->size() returns -1. However, in order to + // maintain the value of |m_bufferedAmount| correctly, the WebSocket code + // needs to fix the size of the File at this point. For this reason, + // construct a new BlobDataHandle here with the size that this method + // observed. + m_channel->send(BlobDataHandle::create(binaryData->uuid(), binaryData->type(), size)); } void DOMWebSocket::close(unsigned short code, const String& reason, ExceptionState& exceptionState) |