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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: remove unused checks Created 3 years, 8 months 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
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..58f804537fd2c4d2d9a91b67c1d8ac8759ffa617 100644
--- a/third_party/WebKit/Source/modules/crypto/Crypto.cpp
+++ b/third_party/WebKit/Source/modules/crypto/Crypto.cpp
@@ -50,28 +50,30 @@ bool isIntegerArray(DOMArrayBufferView* array) {
} // namespace
-DOMArrayBufferView* Crypto::getRandomValues(DOMArrayBufferView* array,
- ExceptionState& exceptionState) {
- ASSERT(array);
- if (!isIntegerArray(array)) {
+DOMArrayBufferView* Crypto::getRandomValues(
+ const NotShared<DOMArrayBufferView>& array,
+ ExceptionState& exceptionState) {
+ DCHECK(array.view());
+ 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()));
+ array.view()->typeName()));
return 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()));
+ array.view()->byteLength()));
return nullptr;
}
- cryptographicallyRandomValues(array->baseAddress(), array->byteLength());
- return array;
+ cryptographicallyRandomValues(array.view()->baseAddress(),
+ array.view()->byteLength());
+ return array.view();
}
SubtleCrypto* Crypto::subtle() {

Powered by Google App Engine
This is Rietveld 408576698