Binding generator should support interfaces with CustomConstructor and NoInterfaceObject
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 May 2015 21:18:37 +0000 (21:18 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 May 2015 21:18:37 +0000 (21:18 +0000)
commitc28c1b11956a21fb4ca432a164e75ec75ff5bd2f
tree0f1c142ac21e7ec59836aef41f8c5ca640214dcd
parentc6902c4df268d0455c3773f724c3caa2f6859dd8
Binding generator should support interfaces with CustomConstructor and NoInterfaceObject
https://bugs.webkit.org/show_bug.cgi?id=145016

Reviewed by Darin Adler.

Updated code generator to generate the necessary declarations (constructor property in the prototype, the constructor class).
In the case of CustomConstructor with NoInterfaceObject, the implementation of the constructor property related JS function is changed as follow:
It creates a constructor object and shadows the constructor property JS function with this object.
This ensures that only one constructor object is created per prototype.
The constructor is not exposed as it is not added to the global object constructor map.

NoInterfaceObject is asking to not make the interface visible, which is contradictory with having a visible constructor of the interface.
The case for having NoInterfaceObject and CustomConstructor is the following:
We do not want to expose the interface but we still want to have a constructor property on the prototype of objects implementing the interface.
One such case is https://streams.spec.whatwg.org/#globals

Added TestCustomConstructorWithNoInterfaceObject.idl to check that case.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateAttributesHashTable):
(GenerateImplementation):
(HasConstructorProperty):
* bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObject.cpp: Added.
(WebKit::kit):
(WebKit::core):
(WebKit::wrapTestCustomConstructorWithNoInterfaceObject):
(webkit_dom_test_custom_constructor_with_no_interface_object_finalize):
(webkit_dom_test_custom_constructor_with_no_interface_object_constructor):
(webkit_dom_test_custom_constructor_with_no_interface_object_class_init):
(webkit_dom_test_custom_constructor_with_no_interface_object_init):
* bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObject.h: Added.
* bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate.h: Added.
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: Added.
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectPrototype::create):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectPrototype::createStructure):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectPrototype::JSTestCustomConstructorWithNoInterfaceObjectPrototype):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::create):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::createStructure):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::JSTestCustomConstructorWithNoInterfaceObjectConstructor):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::finishCreation):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectConstructor::getConstructData):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectPrototype::finishCreation):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::JSTestCustomConstructorWithNoInterfaceObject):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::createPrototype):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::getPrototype):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::destroy):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::~JSTestCustomConstructorWithNoInterfaceObject):
(WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::getConstructor):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots):
(WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::finalize):
(WebCore::toJS):
(WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h: Added.
(WebCore::wrapperOwner):
(WebCore::toJS):
* bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObject.h: Added.
* bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObject.mm: Added.
(-[DOMTestCustomConstructorWithNoInterfaceObject dealloc]):
(-[DOMTestCustomConstructorWithNoInterfaceObject finalize]):
(core):
(kit):
* bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObjectInternal.h: Added.
* bindings/scripts/test/TestCustomConstructor.idl: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObject.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObject.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomConstructorWithNoInterfaceObjectPrivate.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObject.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObject.mm [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomConstructorWithNoInterfaceObjectInternal.h [new file with mode: 0644]
Source/WebCore/bindings/scripts/test/TestCustomConstructor.idl [new file with mode: 0644]