This source file includes following definitions.
- getRandomValuesMethodCustom
#include "config.h"
#include "V8Crypto.h"
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/custom/V8ArrayBufferViewCustom.h"
#include "core/dom/ExceptionCode.h"
#include "modules/crypto/Crypto.h"
#include "wtf/ArrayBufferView.h"
namespace WebCore {
void V8Crypto::getRandomValuesMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ExceptionState exceptionState(ExceptionState::ExecutionContext, "getRandomValues", "Crypto", info.Holder(), info.GetIsolate());
if (info.Length() < 1) {
exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
exceptionState.throwIfNeeded();
return;
}
v8::Handle<v8::Value> buffer = info[0];
if (!V8ArrayBufferView::hasInstance(buffer, info.GetIsolate())) {
exceptionState.throwTypeError("First argument is not an ArrayBufferView");
} else {
ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(buffer));
ASSERT(arrayBufferView);
Crypto* crypto = V8Crypto::toNative(info.Holder());
crypto->getRandomValues(arrayBufferView, exceptionState);
}
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValue(info, buffer);
}
}