Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1778)

Unified Diff: Source/modules/crypto/Crypto.cpp

Issue 801283002: [bindings] Make Crypto.getRandomValues use generated binding rather than using custom binding. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/Crypto.h ('k') | Source/modules/crypto/Crypto.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/Crypto.cpp
diff --git a/Source/modules/crypto/Crypto.cpp b/Source/modules/crypto/Crypto.cpp
index 01a3f19e8c75dddc0030f659499ebc33549f749d..5d7e66ab2d13838b75b146fed18add358350ea4c 100644
--- a/Source/modules/crypto/Crypto.cpp
+++ b/Source/modules/crypto/Crypto.cpp
@@ -53,21 +53,22 @@ bool isIntegerArray(DOMArrayBufferView* array)
} // namespace
-void Crypto::getRandomValues(DOMArrayBufferView* array, ExceptionState& exceptionState)
+DOMArrayBufferView* Crypto::getRandomValues(DOMArrayBufferView* array, ExceptionState& exceptionState)
{
if (!array) {
exceptionState.throwDOMException(TypeMismatchError, "The provided ArrayBufferView is null.");
- return;
+ return nullptr;
}
if (!isIntegerArray(array)) {
exceptionState.throwDOMException(TypeMismatchError, String::format("The provided ArrayBufferView is of type '%s', which is not an integer array type.", array->typeName()));
- return;
+ return nullptr;
}
if (array->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;
+ return nullptr;
}
cryptographicallyRandomValues(array->baseAddress(), array->byteLength());
+ return array;
}
SubtleCrypto* Crypto::subtle()
« no previous file with comments | « Source/modules/crypto/Crypto.h ('k') | Source/modules/crypto/Crypto.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698