Bug 1393837 - Make sure codegen includes all the parent interfaces r=peterv draft
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 06 Sep 2017 10:33:45 +0200
changeset 659727 2fa38d0ebaa894a381b3daf0b4de57346a9f911d
parent 659710 b235fb79d6e017b9f47309cb06eb701c06b7e8d2
child 730047 1ac0a8b37fe733f0d5702728d17bcd39d3422fe3
push id78193
push uservalentin.gosu@gmail.com
push dateWed, 06 Sep 2017 08:35:26 +0000
reviewerspeterv
bugs1393837
milestone57.0a1
Bug 1393837 - Make sure codegen includes all the parent interfaces r=peterv MozReview-Commit-ID: 5UWExNmYyME
dom/bindings/Codegen.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -1075,16 +1075,30 @@ class CGHeaders(CGWrapper):
                 # interface object as the proto of our interface object.
                 if iface.hasInterfaceObject():
                     parent = iface.parent
                     while parent and not parent.hasInterfaceObject():
                         parent = parent.parent
                     if parent:
                         ancestors.append(parent)
         interfaceDeps.extend(ancestors)
+
+        # Include parent interface headers needed for jsonifier code.
+        jsonInterfaceParents = []
+        for desc in descriptors:
+            if not desc.operations['Jsonifier']:
+                continue
+            parent = desc.interface.parent
+            while parent:
+                parentDesc = desc.getDescriptor(parent.identifier.name)
+                if parentDesc.operations['Jsonifier']:
+                    jsonInterfaceParents.append(parentDesc.interface)
+                parent = parent.parent
+        interfaceDeps.extend(jsonInterfaceParents)
+
         bindingIncludes = set(self.getDeclarationFilename(d) for d in interfaceDeps)
 
         # Grab all the implementation declaration files we need.
         implementationIncludes = set(d.headerFile for d in descriptors if d.needsHeaderInclude())
 
         # Grab the includes for checking hasInstance
         interfacesImplementingSelf = set()
         for d in descriptors: