Index: Source/modules/websockets/WebSocket.cpp |
diff --git a/Source/modules/websockets/WebSocket.cpp b/Source/modules/websockets/WebSocket.cpp |
index 7939a9eac98c96391bf1a185274550ade89c67cf..2ae0d1509e7536223c77218042707a3c0225c71d 100644 |
--- a/Source/modules/websockets/WebSocket.cpp |
+++ b/Source/modules/websockets/WebSocket.cpp |
@@ -54,6 +54,7 @@ |
#include "public/platform/Platform.h" |
#include "wtf/ArrayBuffer.h" |
#include "wtf/ArrayBufferView.h" |
+#include "wtf/Assertions.h" |
#include "wtf/HashSet.h" |
#include "wtf/PassOwnPtr.h" |
#include "wtf/StdLibExtras.h" |
@@ -635,7 +636,14 @@ void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData) |
} |
case BinaryTypeArrayBuffer: |
- m_eventQueue->dispatch(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size()), SecurityOrigin::create(m_url)->toString())); |
+ RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(binaryData->data(), binaryData->size()); |
+ if (!arrayBuffer) { |
+ // 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(); |
+ } |
+ m_eventQueue->dispatch(MessageEvent::create(arrayBuffer.release(), SecurityOrigin::create(m_url)->toString())); |
break; |
} |
} |