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

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

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: add some layout tests 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..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;
}

Powered by Google App Engine
This is Rietveld 408576698