Bug 1379688 part 1. Remove some restrictions on whether an interface that implements QueryInterface can have a non-abstract ancestor. r=smaug

This restriction was put in place back when we automatically added
QueryInterface to all rootmost non-abstract interfaces.  At the time, we needed
to make sure it did NOT end up on EventTarget, because then webidl quickstubs
would replace the QI impl on non-webidl EventTargets with the WebIDL one, which
would not work for them.

Since then, we have removed WebIDL quickstubs and we now explicitly list which
interfaces get QueryInterface, so this check is no longer needed.

MozReview-Commit-ID: 5B13ymdyLp3
This commit is contained in:
Boris Zbarsky 2017-11-20 13:59:20 -05:00
parent 486cc0b4e7
commit 3dd8d0e9c1

View File

@ -2381,22 +2381,11 @@ class MethodDefiner(PropertyDefiner):
if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]): if len(signatures) > 1 or len(signatures[0][1]) > 1 or not argTypeIsIID(signatures[0][1][0]):
raise TypeError("There should be only one queryInterface method with 1 argument of type IID") raise TypeError("There should be only one queryInterface method with 1 argument of type IID")
# Make sure to not stick QueryInterface on abstract interfaces that # Make sure to not stick QueryInterface on abstract interfaces.
# have hasXPConnectImpls (like EventTarget). So only put it on
# interfaces that are concrete and all of whose ancestors are abstract.
def allAncestorsAbstract(iface):
if not iface.parent:
return True
desc = self.descriptor.getDescriptor(iface.parent.identifier.name)
if desc.concrete:
return False
return allAncestorsAbstract(iface.parent)
if (not self.descriptor.interface.hasInterfacePrototypeObject() or if (not self.descriptor.interface.hasInterfacePrototypeObject() or
not self.descriptor.concrete or not self.descriptor.concrete):
not allAncestorsAbstract(self.descriptor.interface)):
raise TypeError("QueryInterface is only supported on " raise TypeError("QueryInterface is only supported on "
"interfaces that are concrete and all " "interfaces that are concrete: " +
"of whose ancestors are abstract: " +
self.descriptor.name) self.descriptor.name)
condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType
self.regular.append({ self.regular.append({