Index: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
index 011ddadef6d79bb5e181d30930495d8824bd4920..2471a6bcd31917c4cb4ab28e92fa303a4429e415 100644 |
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
@@ -80,7 +80,7 @@ public: |
void didReceiveData() override { } |
void didFinishLoading() override |
{ |
- m_PresentationConnection->didFinishLoadingBlob(m_loader.arrayBufferResult()); |
+ m_PresentationConnection->didFinishLoadingBlob(m_loader.arrayBufferResultOrNull()); |
} |
void didFail(FileError::ErrorCode errorCode) override |
{ |
@@ -207,7 +207,8 @@ void PresentationConnection::send(PassRefPtr<DOMArrayBufferView> arrayBufferView |
if (!canSendMessage(exceptionState)) |
return; |
- m_messages.append(adoptPtr(new Message(arrayBufferView->buffer()))); |
+ RefPtr<DOMArrayBuffer> buffer = arrayBufferView->buffer(); |
+ m_messages.append(adoptPtr(new Message(buffer))); |
handleMessageQueue(); |
} |
@@ -304,7 +305,13 @@ void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data, size_t |
return; |
} |
case BinaryTypeArrayBuffer: |
- RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, length); |
+ // TODO(junov): crbug.com/536816 |
+ // Use createOrNull instead of deprecatedCReateOrCrash. Requires |
+ // determining an acceptable alternative to crashing when buffer |
+ // allocation fails. Should we just drop the event? Dispatch |
+ // an event with null data? Dispatch some kind of error code? |
+ // Behavior needs to be defined in the spec. |
+ RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::deprecatedCreateOrCrash(data, length); |
dispatchEvent(MessageEvent::create(buffer.release())); |
return; |
} |