Index: third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp |
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp |
index f68c76779941577de2f63eb62323949d601ffe41..d3f512f33d8a7ce13d1b866695637c77768fa12d 100644 |
--- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp |
+++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp |
@@ -638,7 +638,12 @@ void DOMWebSocket::didReceiveBinaryMessage(PassOwnPtr<Vector<char>> binaryData) |
} |
case BinaryTypeArrayBuffer: |
- RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(binaryData->data(), binaryData->size()); |
+ // TODO(junov): crbug.com/536816 |
+ // Avoid crashing when out of memory by using createOrNull(). Requires |
+ // determining appropriate alternate behavior for dealing with allocation |
+ // failures. Should the event be dropped? Should we dispatch an event |
+ // with null data? Should we dispatch some kind of failure code? |
+ RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::deprecatedCreateOrCrash(binaryData->data(), binaryData->size()); |
Platform::current()->histogramEnumeration("WebCore.WebSocket.ReceiveType", WebSocketReceiveTypeArrayBuffer, WebSocketReceiveTypeMax); |
m_eventQueue->dispatch(MessageEvent::create(arrayBuffer.release(), SecurityOrigin::create(m_url)->toString())); |
break; |