| Index: third_party/WebKit/Source/modules/crypto/Crypto.cpp
|
| diff --git a/third_party/WebKit/Source/modules/crypto/Crypto.cpp b/third_party/WebKit/Source/modules/crypto/Crypto.cpp
|
| index 96506e4cbf0cb348a792b610801ac025c14969de..bec34ca3efe38c39e6817313fff08a44c3610f7d 100644
|
| --- a/third_party/WebKit/Source/modules/crypto/Crypto.cpp
|
| +++ b/third_party/WebKit/Source/modules/crypto/Crypto.cpp
|
| @@ -50,27 +50,29 @@ bool isIntegerArray(DOMArrayBufferView* array) {
|
|
|
| } // namespace
|
|
|
| -DOMArrayBufferView* Crypto::getRandomValues(DOMArrayBufferView* array,
|
| - ExceptionState& exceptionState) {
|
| - ASSERT(array);
|
| - if (!isIntegerArray(array)) {
|
| +NotShared<DOMArrayBufferView> Crypto::getRandomValues(
|
| + NotShared<DOMArrayBufferView> array,
|
| + ExceptionState& exceptionState) {
|
| + DCHECK(array);
|
| + if (!isIntegerArray(array.view())) {
|
| exceptionState.throwDOMException(
|
| TypeMismatchError,
|
| String::format("The provided ArrayBufferView is of type '%s', which is "
|
| "not an integer array type.",
|
| - array->typeName()));
|
| - return nullptr;
|
| + array.view()->typeName()));
|
| + return NotShared<DOMArrayBufferView>(nullptr);
|
| }
|
| - if (array->byteLength() > 65536) {
|
| + if (array.view()->byteLength() > 65536) {
|
| exceptionState.throwDOMException(
|
| QuotaExceededError,
|
| String::format("The ArrayBufferView's byte length (%u) exceeds the "
|
| "number of bytes of entropy available via this API "
|
| "(65536).",
|
| - array->byteLength()));
|
| - return nullptr;
|
| + array.view()->byteLength()));
|
| + return NotShared<DOMArrayBufferView>(nullptr);
|
| }
|
| - cryptographicallyRandomValues(array->baseAddress(), array->byteLength());
|
| + cryptographicallyRandomValues(array.view()->baseAddress(),
|
| + array.view()->byteLength());
|
| return array;
|
| }
|
|
|
|
|