Commit bec7dcdc authored by haraken@chromium.org's avatar haraken@chromium.org

Implement the [Supplemental] IDL for custom methods

https://bugs.webkit.org/show_bug.cgi?id=76036

Reviewed by Adam Barth.

We have implemented the [Supplemental] IDL for non-custom methods in bug 75944.
This patch implements it for custom methods. This patch modifies only CodeGeneratorV8.pm,
since CodeGeneratorJS.pm requires no change and other code generators
do not support custom methods.

Test: bindings/scripts/test/TestSupplemental.idl

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):

* bindings/scripts/test/TestSupplemental.idl: Added a custom method with the [Supplemental] IDL.

* bindings/scripts/test/JS/JSTestInterface.cpp: Updated the test result.
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3):
* bindings/scripts/test/JS/JSTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto.
(-[DOMTestInterface supplementalMethod3]):
* bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104767 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eea05cb1
2012-01-11 Kentaro Hara <haraken@chromium.org>
Implement the [Supplemental] IDL for custom methods
https://bugs.webkit.org/show_bug.cgi?id=76036
Reviewed by Adam Barth.
We have implemented the [Supplemental] IDL for non-custom methods in bug 75944.
This patch implements it for custom methods. This patch modifies only CodeGeneratorV8.pm,
since CodeGeneratorJS.pm requires no change and other code generators
do not support custom methods.
Test: bindings/scripts/test/TestSupplemental.idl
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader):
* bindings/scripts/test/TestSupplemental.idl: Added a custom method with the [Supplemental] IDL.
* bindings/scripts/test/JS/JSTestInterface.cpp: Updated the test result.
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3):
* bindings/scripts/test/JS/JSTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.h: Ditto.
* bindings/scripts/test/ObjC/DOMTestInterface.mm: Ditto.
(-[DOMTestInterface supplementalMethod3]):
* bindings/scripts/test/V8/V8TestInterface.cpp: Ditto.
2011-12-21 Shaw Andy <andy.shaw@digia.com>
Fix build issue on Windows when Qt is configured with -ltcg
......@@ -400,7 +400,7 @@ END
my $name = $function->signature->name;
my $attrExt = $function->signature->extendedAttributes;
if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && $function->{overloadIndex} == 1) {
if (($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) && !$attrExt->{"ImplementedBy"} && $function->{overloadIndex} == 1) {
push(@headerContent, <<END);
static v8::Handle<v8::Value> ${name}Callback(const v8::Arguments&);
END
......
......@@ -136,11 +136,14 @@ static const HashTableValue JSTestInterfacePrototypeTableValues[] =
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
{ "supplementalMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t)2, NoIntrinsic },
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
{ "supplementalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t)0, NoIntrinsic },
#endif
{ 0, 0, 0, 0, NoIntrinsic }
};
static const HashTable JSTestInterfacePrototypeTable = { 5, 3, JSTestInterfacePrototypeTableValues, 0 };
static const HashTable JSTestInterfacePrototypeTable = { 8, 7, JSTestInterfacePrototypeTableValues, 0 };
const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
......@@ -317,6 +320,19 @@ EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSTestInterface::s_info))
return throwVMTypeError(exec);
JSTestInterface* castedThis = static_cast<JSTestInterface*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info);
return JSValue::encode(castedThis->supplementalMethod3(exec));
}
#endif
static inline bool isObservable(JSTestInterface* jsTestInterface)
{
if (jsTestInterface->hasCustomProperties())
......
......@@ -58,6 +58,9 @@ public:
// Custom attributes
JSC::JSValue supplementalStr3(TestInterface*, JSC::ExecState*) const;
// Custom functions
JSC::JSValue supplementalMethod3(JSC::ExecState*);
TestInterface* impl() const { return m_impl; }
void releaseImpl() { m_impl->deref(); m_impl = 0; }
......@@ -146,6 +149,7 @@ protected:
JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(JSC::ExecState*);
// Attributes
JSC::JSValue jsTestInterfaceSupplementalStr1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
......
......@@ -45,6 +45,7 @@
#endif
- (void)supplementalMethod1;
- (DOMTestObj *)supplementalMethod2:(NSString *)strArg objArg:(DOMTestObj *)objArg;
- (void)supplementalMethod3;
@end
#endif
......@@ -131,6 +131,16 @@
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
- (void)supplementalMethod3
{
WebCore::JSMainThreadNullState state;
TestSupplemental::supplementalMethod3(IMPL);
}
#endif
@end
WebCore::TestInterface* core(DOMTestInterface *wrapper)
......
......@@ -39,5 +39,6 @@ module test {
void supplementalMethod1();
[CallWith=ScriptExecutionContext] TestObj supplementalMethod2(in DOMString strArg, in TestObj objArg) raises(DOMException);
[Custom] void supplementalMethod3();
};
}
......@@ -141,6 +141,9 @@ static const BatchedCallback TestInterfaceCallbacks[] = {
#if ENABLE(Condition11) || ENABLE(Condition12)
{"supplementalMethod1", TestInterfaceInternal::supplementalMethod1Callback},
#endif
#if ENABLE(Condition11) || ENABLE(Condition12)
{"supplementalMethod3", V8TestInterface::supplementalMethod3Callback},
#endif
};
v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment