| Index: third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp | 
| diff --git a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp | 
| index 7efd0097e99174319967326f84ecda015b77219b..fc9352a65774a9d50064cfc4a0adb6458a2cb94a 100644 | 
| --- a/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp | 
| +++ b/third_party/WebKit/Source/modules/crypto/CryptoResultImpl.cpp | 
| @@ -181,7 +181,21 @@ void CryptoResultImpl::completeWithBuffer(const void* bytes, unsigned bytesSize) | 
| if (!m_resolver) | 
| return; | 
|  | 
| -    m_resolver->resolve(DOMArrayBuffer::create(bytes, bytesSize)); | 
| +    // TODO(junov): crbug.com/536816 | 
| +    // Instead of crashing when array buffer allocation fails, we could | 
| +    // and probably should use DOMArrayBuffer::createOrNull and reject | 
| +    // the promise with a RangeError exception when creation returns null. | 
| +    // The specs for all crypto methods that use this code state: "If the | 
| +    // following steps or referenced procedures say to throw an error, | 
| +    // reject promise with the returned error and then terminate the algorithm." | 
| +    // In this case, the procedure of allocating an ArrayBuffer is not explicitly | 
| +    // referenced in the algorithms laid out in the spec, but one could argue | 
| +    // that it is implied, and the ECMAScript spec says that failure to | 
| +    // allocate the buffer should result in a RangeError being thrown. | 
| +    // http://ecma-international.org/ecma-262/6.0/#sec-createbytedatablock | 
| +    // The crypto spec probably needs to be edited to be more explicit about | 
| +    // this issue. | 
| +    m_resolver->resolve(DOMArrayBuffer::deprecatedCreateOrCrash(bytes, bytesSize)); | 
| clearResolver(); | 
| } | 
|  | 
|  |