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

Unified Diff: Source/bindings/tests/results/core/V8TestObject.cpp

Issue 1051753003: bindings: Add toBoolean() to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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: Source/bindings/tests/results/core/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/core/V8TestObject.cpp b/Source/bindings/tests/results/core/V8TestObject.cpp
index 535c45fe8c1abcbae000999c6d2d3c1c9ad48911..39ec0fc47fd5db87b358cdc296233966ffacb06f 100644
--- a/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -375,8 +375,11 @@ static void booleanAttributeAttributeGetterCallback(v8::Local<v8::Name>, const v
static void booleanAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+ ExceptionState exceptionState(ExceptionState::SetterContext, "booleanAttribute", "TestObject", holder, info.GetIsolate());
TestObject* impl = V8TestObject::toImpl(holder);
- bool cppValue = v8Value->BooleanValue();
+ bool cppValue = toBoolean(info.GetIsolate(), v8Value, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
impl->setBooleanAttribute(cppValue);
}
@@ -3829,8 +3832,11 @@ static void reflectBooleanAttributeAttributeGetterCallback(v8::Local<v8::Name>,
static void reflectBooleanAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
v8::Local<v8::Object> holder = info.Holder();
+ ExceptionState exceptionState(ExceptionState::SetterContext, "reflectBooleanAttribute", "TestObject", holder, info.GetIsolate());
TestObject* impl = V8TestObject::toImpl(holder);
- bool cppValue = v8Value->BooleanValue();
+ bool cppValue = toBoolean(info.GetIsolate(), v8Value, exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
impl->setBooleanAttribute(HTMLNames::reflectbooleanattributeAttr, cppValue);
}
@@ -5939,14 +5945,18 @@ static void voidMethodDOMTimeStampArgMethodCallback(const v8::FunctionCallbackIn
static void voidMethodBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodBooleanArg", "TestObject", info.Holder(), info.GetIsolate());
if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodBooleanArg", "TestObject", 1, info.Length()), info.GetIsolate());
+ setMinimumArityTypeError(exceptionState, 1, info.Length());
+ exceptionState.throwIfNeeded();
return;
}
TestObject* impl = V8TestObject::toImpl(info.Holder());
bool booleanArg;
{
- booleanArg = info[0]->BooleanValue();
+ booleanArg = toBoolean(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
}
impl->voidMethodBooleanArg(booleanArg);
}
@@ -8219,11 +8229,14 @@ static void voidMethodDefaultDoubleArgMethodCallback(const v8::FunctionCallbackI
static void voidMethodDefaultTrueBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDefaultTrueBooleanArg", "TestObject", info.Holder(), info.GetIsolate());
TestObject* impl = V8TestObject::toImpl(info.Holder());
bool defaultBooleanArg;
{
if (!info[0]->IsUndefined()) {
- defaultBooleanArg = info[0]->BooleanValue();
+ defaultBooleanArg = toBoolean(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
} else {
defaultBooleanArg = true;
}
@@ -8240,11 +8253,14 @@ static void voidMethodDefaultTrueBooleanArgMethodCallback(const v8::FunctionCall
static void voidMethodDefaultFalseBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDefaultFalseBooleanArg", "TestObject", info.Holder(), info.GetIsolate());
TestObject* impl = V8TestObject::toImpl(info.Holder());
bool defaultBooleanArg;
{
if (!info[0]->IsUndefined()) {
- defaultBooleanArg = info[0]->BooleanValue();
+ defaultBooleanArg = toBoolean(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
} else {
defaultBooleanArg = false;
}
@@ -9945,6 +9961,7 @@ static void callWithScriptStateScriptArgumentsVoidMethodMethodCallback(const v8:
static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg", "TestObject", info.Holder(), info.GetIsolate());
TestObject* impl = V8TestObject::toImpl(info.Holder());
bool optionalBooleanArg;
{
@@ -9954,7 +9971,9 @@ static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethod
impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release());
return;
}
- optionalBooleanArg = info[0]->BooleanValue();
+ optionalBooleanArg = toBoolean(info.GetIsolate(), info[0], exceptionState);
+ if (exceptionState.throwIfNeeded())
+ return;
}
ScriptState* scriptState = ScriptState::current(info.GetIsolate());
RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 1));

Powered by Google App Engine
This is Rietveld 408576698