diff options
author | Moonchild <moonchild@palemoon.org> | 2021-07-12 02:54:51 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-07-12 02:54:51 +0000 |
commit | 006493a09d07f22b95c5c60128a77649ca4e6353 (patch) | |
tree | fa721aaaa3585c862581a7f033d6561e5cab5276 | |
parent | b6e3f350114de089577bb355604480d8d300c5c5 (diff) | |
download | uxp-006493a09d07f22b95c5c60128a77649ca4e6353.tar.gz |
Issue mcp-graveyard/UXP#1792 - Part 1: Remove superfluous check for abstract ancestors.
This removes some restrictions on whether an interface that implements
QueryInterface can have a non-abstract ancestor.
This restriction was put in place back when we automatically added
QueryInterface to all rootmost non-abstract interfaces (~Pale Moon 24).
At the time, we needed to make sure it did NOT end up on EventTarget, because
back then WebIDL quickstubs would replace the QI implementation 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.
-rw-r--r-- | dom/bindings/Codegen.py | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index c9a5e9f419..42ce94fcb4 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -2321,22 +2321,11 @@ class MethodDefiner(PropertyDefiner): 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") - # Make sure to not stick QueryInterface on abstract interfaces that - # 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) + # Make sure to not stick QueryInterface on abstract interfaces. if (not self.descriptor.interface.hasInterfacePrototypeObject() or - not self.descriptor.concrete or - not allAncestorsAbstract(self.descriptor.interface)): + not self.descriptor.concrete): raise TypeError("QueryInterface is only supported on " - "interfaces that are concrete and all " - "of whose ancestors are abstract: " + + "interfaces that are concrete: " + self.descriptor.name) condition = "WantsQueryInterface<%s>::Enabled" % descriptor.nativeType self.regular.append({ |