Index: Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp |
diff --git a/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp b/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp |
index f66c0f15f6d66acb8b278374a6aceecec3760a6e..90146edf4358ac7ea36b218eaebf14bc4c360929 100644 |
--- a/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp |
+++ b/Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp |
@@ -50,6 +50,7 @@ |
#include "public/platform/Platform.h" |
#include "public/platform/WebWaitableEvent.h" |
#include "wtf/ArrayBuffer.h" |
+#include "wtf/Assertions.h" |
#include "wtf/Functional.h" |
#include "wtf/MainThread.h" |
@@ -305,6 +306,12 @@ void WorkerThreadableWebSocketChannel::Peer::sendArrayBuffer(PassOwnPtr<Vector<c |
m_syncHelper->setSendRequestResult(WebSocketChannel::SendFail); |
} else { |
RefPtr<ArrayBuffer> binaryData = ArrayBuffer::create(data->data(), data->size()); |
+ if (!binaryData) { |
+ // Failed to allocate an ArrayBuffer. We need to crash the renderer |
+ // since there's no way defined in the spec to tell this to the |
+ // user. |
+ CRASH(); |
+ } |
WebSocketChannel::SendResult sendRequestResult = m_mainWebSocketChannel->send(*binaryData, 0, binaryData->byteLength()); |
m_syncHelper->setSendRequestResult(sendRequestResult); |
} |