Bug 852219 part 6. Handle cases when the C++ class we want to actually inherit from is not the one that the WebIDL interface is mapped to. r=mccr8

This commit is contained in:
Boris Zbarsky 2013-04-03 22:22:16 -04:00
parent c4a0a2468f
commit d1d7bbfca7
4 changed files with 17 additions and 2 deletions

View File

@ -322,6 +322,7 @@ DOMInterfaces = {
{
'hasXPConnectImpls': True,
'concrete': False,
'jsImplParent': 'nsDOMEventTargetHelper'
},
{
'workers': True,
@ -1222,6 +1223,11 @@ DOMInterfaces = {
'register': False
},
'TestJSImplInterface4' : {
'headerFile': 'TestJSImplGenBinding.h',
'register': False
},
'TestExternalInterface' : {
'nativeType': 'mozilla::dom::TestExternalInterface',
'headerFile': 'TestBindingHeader.h',

View File

@ -606,7 +606,7 @@ class CGHeaders(CGWrapper):
jsParent = jsImplemented.interface.parent
if jsParent:
parentDesc = jsImplemented.getDescriptor(jsParent.identifier.name)
declareIncludes.add(parentDesc.headerFile)
declareIncludes.add(parentDesc.jsImplParentHeader)
# Let the machinery do its thing.
def _includeString(includes):
@ -8097,7 +8097,7 @@ class CGJSImplClass(CGBindingImplClass):
if descriptor.interface.parent:
parentClass = descriptor.getDescriptor(
descriptor.interface.parent.identifier.name).nativeType
descriptor.interface.parent.identifier.name).jsImplParent
baseClasses = [ClassBase(parentClass)]
isupportsDecl = "NS_DECL_ISUPPORTS_INHERITED"
ccDecl = ("NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(%s, %s)" %

View File

@ -211,6 +211,7 @@ class Descriptor(DescriptorProvider):
nativeTypeDefault = "mozilla::dom::" + ifaceName
self.nativeType = desc.get('nativeType', nativeTypeDefault)
self.jsImplParent = desc.get('jsImplParent', self.nativeType)
# Do something sane for JSObject
if self.nativeType == "JSObject":
@ -229,6 +230,10 @@ class Descriptor(DescriptorProvider):
headerDefault = self.nativeType
headerDefault = headerDefault.replace("::", "/") + ".h"
self.headerFile = desc.get('headerFile', headerDefault)
if self.jsImplParent == self.nativeType:
self.jsImplParentHeader = self.headerFile
else:
self.jsImplParentHeader = self.jsImplParent.replace("::", "/") + ".h"
self.skipGen = desc.get('skipGen', False)

View File

@ -11,3 +11,7 @@ interface TestJSImplInterface2 : TestCImplementedInterface {
[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface3;1"]
interface TestJSImplInterface3 : TestCImplementedInterface2 {
};
[Constructor, JSImplementation="@mozilla.org/test-js-impl-interface4;1"]
interface TestJSImplInterface4 : EventTarget {
};