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..d183e31f9f5203750f1bdb7c59ec0adeda416fca 100644 |
--- a/Source/bindings/v8/custom/V8CryptoCustom.cpp |
+++ b/Source/bindings/v8/custom/V8CryptoCustom.cpp |
@@ -41,22 +41,22 @@ namespace WebCore { |
// * Must be threadsafe |
void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRandomValues", "Crypto", info.Holder(), info.GetIsolate()); |
if (info.Length() < 1) { |
- throwTypeError(ExceptionMessages::failedToExecute("getRandomValues", "Crypto", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); |
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
+ exceptionState.throwIfNeeded(); |
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; |