diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index c3dc4d2311a..166ce3ab02f 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2283,8 +2283,8 @@ class CGIDLInterface(CGThing): name = self.descriptor.name if (interface.getUserData("hasConcreteDescendant", False) or interface.getUserData("hasProxyDescendant", False)): - depth = len(self.descriptor.prototypeChain) - check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth - 1, name) + depth = self.descriptor.prototypeDepth + check = "class.interface_chain[%s] == PrototypeList::ID::%s" % (depth, name) elif self.descriptor.proxy: check = "class as *const _ == &Class as *const _" else: diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py index 2106ff4adee..ac78e52c071 100644 --- a/components/script/dom/bindings/codegen/Configuration.py +++ b/components/script/dom/bindings/codegen/Configuration.py @@ -296,6 +296,7 @@ class Descriptor(DescriptorProvider): while parent: self.prototypeChain.insert(0, parent.identifier.name) parent = parent.parent + self.prototypeDepth = len(self.prototypeChain) - 1 config.maxProtoChainLength = max(config.maxProtoChainLength, len(self.prototypeChain))