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

Unified Diff: Source/bindings/v8/custom/V8CryptoCustom.cpp

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
Index: Source/bindings/v8/custom/V8CryptoCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CryptoCustom.cpp b/Source/bindings/v8/custom/V8CryptoCustom.cpp
index 7abea6ff09c507804054fc10101871e2ae6bb7b8..e1a6f1e246fd07bd3c419d799f8120da00ffad3f 100644
--- a/Source/bindings/v8/custom/V8CryptoCustom.cpp
+++ b/Source/bindings/v8/custom/V8CryptoCustom.cpp
@@ -25,7 +25,6 @@
#include "config.h"
#include "V8Crypto.h"
-#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8Utilities.h"
@@ -41,22 +40,21 @@ namespace WebCore {
// * Must be threadsafe
void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRandomValues", "Crypto", info.Holder(), info.GetIsolate());
Mike West 2013/12/05 11:48:59 These custom bindings changes look reasonable, tha
if (info.Length() < 1) {
- throwTypeError(ExceptionMessages::failedToExecute("getRandomValues", "Crypto", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
+ exceptionState.notEnoughArguments(1, info.Length());
return;
}
v8::Handle<v8::Value> buffer = info[0];
if (!V8ArrayBufferView::hasInstance(buffer, info.GetIsolate(), worldType(info.GetIsolate()))) {
- throwTypeError("First argument is not an ArrayBufferView", info.GetIsolate());
- return;
- }
+ exceptionState.throwTypeError("First argument is not an ArrayBufferView");
+ } else {
+ ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(buffer));
+ ASSERT(arrayBufferView);
- ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(buffer));
- ASSERT(arrayBufferView);
-
- ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRandomValues", "Crypto", info.Holder(), info.GetIsolate());
- Crypto::getRandomValues(arrayBufferView, exceptionState);
+ Crypto::getRandomValues(arrayBufferView, exceptionState);
+ }
if (exceptionState.throwIfNeeded())
return;

Powered by Google App Engine
This is Rietveld 408576698