Chromium Code Reviews| 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; |