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

Unified Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 112383002: IDL compiler: sync Python to r163665 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: New test results 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/tests/results/V8TestInterface.cpp
diff --git a/Source/bindings/tests/results/V8TestInterface.cpp b/Source/bindings/tests/results/V8TestInterface.cpp
index 473f9869843aad339671d9a3badf8a3475700d05..04799ce3b95a24e4dab1a93d50ee9aba84499c85 100644
--- a/Source/bindings/tests/results/V8TestInterface.cpp
+++ b/Source/bindings/tests/results/V8TestInterface.cpp
@@ -563,9 +563,13 @@ static void implementsMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& i
}
TestInterface* imp = V8TestInterface::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
- V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0);
+ if (info.Length() <= 1 || !info[1]->IsFunction()) {
+ throwTypeError(ExceptionMessages::failedToExecute("implementsMethod2", "TestInterface", "The callback provided as parameter 2 is not a function."), info.GetIsolate());
+ return;
+ }
+ OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::Cast(info[1]), getExecutionContext());
ExecutionContext* scriptContext = getExecutionContext();
- RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, imp, strArg, objArg, exceptionState);
+ RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, imp, strArg, objArg.release(), exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValue(info, result.release());
@@ -625,9 +629,13 @@ static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>&
}
TestInterface* imp = V8TestInterface::toNative(info.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
- V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8::Object>::Cast(info[1])) : 0);
+ if (info.Length() <= 1 || !info[1]->IsFunction()) {
+ throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2", "TestInterface", "The callback provided as parameter 2 is not a function."), info.GetIsolate());
+ return;
+ }
+ OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::Cast(info[1]), getExecutionContext());
ExecutionContext* scriptContext = getExecutionContext();
- RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptContext, imp, strArg, objArg, exceptionState);
+ RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptContext, imp, strArg, objArg.release(), exceptionState);
if (exceptionState.throwIfNeeded())
return;
v8SetReturnValue(info, result.release());
@@ -810,11 +818,15 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceAttribute
static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceMethods[] = {
{"implementsMethod1", TestInterfaceV8Internal::implementsMethod1MethodCallback, 0, 0},
+ {"implementsMethod2", TestInterfaceV8Internal::implementsMethod2MethodCallback, 0, 2},
{"implementsMethod3", TestInterfaceV8Internal::implementsMethod3MethodCallback, 0, 0},
#if ENABLE(Condition11) || ENABLE(Condition12)
{"supplementalMethod1", TestInterfaceV8Internal::supplementalMethod1MethodCallback, 0, 0},
#endif // ENABLE(Condition11) || ENABLE(Condition12)
#if ENABLE(Condition11) || ENABLE(Condition12)
+ {"supplementalMethod2", TestInterfaceV8Internal::supplementalMethod2MethodCallback, 0, 2},
+#endif // ENABLE(Condition11) || ENABLE(Condition12)
+#if ENABLE(Condition11) || ENABLE(Condition12)
{"supplementalMethod3", TestInterfaceV8Internal::supplementalMethod3MethodCallback, 0, 0},
#endif // ENABLE(Condition11) || ENABLE(Condition12)
};
@@ -873,22 +885,8 @@ static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Han
COMPILE_ASSERT(1 == TestPartialInterface::SUPPLEMENTALCONSTANT1, TheValueOfTestInterface_SUPPLEMENTALCONSTANT1DoesntMatchWithImplementation);
COMPILE_ASSERT(2 == TestPartialInterface::CONST_IMPL, TheValueOfTestInterface_CONST_IMPLDoesntMatchWithImplementation);
functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterfaceV8Internal::namedPropertyGetterCallback, TestInterfaceV8Internal::namedPropertySetterCallback, TestInterfaceV8Internal::namedPropertyQueryCallback, 0, TestInterfaceV8Internal::namedPropertyEnumeratorCallback);
-
- // Custom Signature 'implementsMethod2'
- const int implementsMethod2Argc = 2;
- v8::Handle<v8::FunctionTemplate> implementsMethod2Argv[implementsMethod2Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8TestObject::wrapperTypeInfo, currentWorldType) };
- v8::Handle<v8::Signature> implementsMethod2Signature = v8::Signature::New(isolate, functionTemplate, implementsMethod2Argc, implementsMethod2Argv);
- prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "implementsMethod2", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::implementsMethod2MethodCallback, v8Undefined(), implementsMethod2Signature, 2));
functionTemplate->Set(v8::String::NewFromUtf8(isolate, "implementsMethod4", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::implementsMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
#if ENABLE(Condition11) || ENABLE(Condition12)
-
- // Custom Signature 'supplementalMethod2'
- const int supplementalMethod2Argc = 2;
- v8::Handle<v8::FunctionTemplate> supplementalMethod2Argv[supplementalMethod2Argc] = { v8::Handle<v8::FunctionTemplate>(), V8PerIsolateData::from(isolate)->rawDOMTemplate(&V8TestObject::wrapperTypeInfo, currentWorldType) };
- v8::Handle<v8::Signature> supplementalMethod2Signature = v8::Signature::New(isolate, functionTemplate, supplementalMethod2Argc, supplementalMethod2Argv);
- prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "supplementalMethod2", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::supplementalMethod2MethodCallback, v8Undefined(), supplementalMethod2Signature, 2));
-#endif // ENABLE(Condition11) || ENABLE(Condition12)
-#if ENABLE(Condition11) || ENABLE(Condition12)
functionTemplate->Set(v8::String::NewFromUtf8(isolate, "supplementalMethod4", v8::String::kInternalizedString), v8::FunctionTemplate::New(isolate, TestInterfaceV8Internal::supplementalMethod4MethodCallback, v8Undefined(), v8::Local<v8::Signature>(), 0));
#endif // ENABLE(Condition11) || ENABLE(Condition12)
functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "implementsStaticReadOnlyAttr", v8::String::kInternalizedString), TestInterfaceV8Internal::implementsStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
« no previous file with comments | « Source/bindings/tests/results/V8TestCallbackInterface.cpp ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698