Index: third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
index 894baa311db4ec1294a50a62ba4c63d0a319fec6..faccbb1b4df917be018d74fc663cd164bc9c033a 100644 |
--- a/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIInput.cpp |
@@ -90,8 +90,14 @@ void MIDIInput::didReceiveMIDIData(unsigned portIndex, const unsigned char* data |
// unless the current process has an explicit permission to handle sysex message. |
if (data[0] == 0xf0 && !midiAccess()->sysexEnabled()) |
return; |
- RefPtr<DOMUint8Array> array = DOMUint8Array::create(data, length); |
- dispatchEvent(MIDIMessageEvent::create(timeStamp, array)); |
+ // TODO(junov) crbug.com/536816: |
+ // Use createOrNull instead of deprecatedCreateOrCrash. Requires determining |
+ // the appropriate course of action for dealing with allocation failures, which |
+ // is currently not specified in the spec. Specification notwithstanding, should |
+ // we just drop the event (silently fail) instead of crashing the process? We could |
+ // also just dispatch the event with null data. |
+ RefPtr<DOMUint8Array> array = DOMUint8Array::deprecatedCreateOrCrash(data, length); |
+ dispatchEvent(MIDIMessageEvent::create(timeStamp, array.release())); |
} |
DEFINE_TRACE(MIDIInput) |