Index: third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
index 9ea9e0dfdf9266329deb5761592abde71230d524..0e3e5b1079c1e0057cec5eb00bf665c8c22d4c5a 100644 |
--- a/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
+++ b/third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp |
@@ -215,7 +215,15 @@ void MIDIOutput::send(Vector<unsigned> unsignedData, double timestamp, Exception |
if (timestamp == 0.0) |
timestamp = now(executionContext()); |
- RefPtr<DOMUint8Array> array = DOMUint8Array::create(unsignedData.size()); |
+ // 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. Throwing a RangeError may be |
+ // appropriate considering the ECMAScript spec: |
+ // http://ecma-international.org/ecma-262/6.0/#sec-createbytedatablock |
+ // However the spec for MIDIOutput.send does not state that such exceptions |
+ // should be re-thrown, so for now we just crash the process when out of memory. |
+ RefPtr<DOMUint8Array> array = DOMUint8Array::deprecatedCreateOrCrash(unsignedData.size()); |
DOMUint8Array::ValueType* const arrayData = array->data(); |
const uint32_t arrayLength = array->length(); |