Generate GetConstructorObject for all interfaces

This commit is contained in:
Connor Brewster 2017-06-12 21:50:53 -06:00
parent 147dfcc99b
commit 0713257add
2 changed files with 6 additions and 2 deletions

View file

@ -2863,7 +2863,7 @@ create_noncallback_interface_object(cx,
%(length)s, %(length)s,
interface.handle_mut()); interface.handle_mut());
assert!(!interface.is_null());""" % properties)) assert!(!interface.is_null());""" % properties))
if self.descriptor.hasDescendants(): if self.descriptor.shouldCacheConstructor():
code.append(CGGeneric("""\ code.append(CGGeneric("""\
assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null()); assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
(*cache)[PrototypeList::Constructor::%(id)s as usize] = interface.get(); (*cache)[PrototypeList::Constructor::%(id)s as usize] = interface.get();

View file

@ -398,7 +398,11 @@ class Descriptor(DescriptorProvider):
assert self.interface.hasInterfaceObject() assert self.interface.hasInterfaceObject()
if self.interface.getExtendedAttribute("Inline"): if self.interface.getExtendedAttribute("Inline"):
return False return False
return self.interface.isCallback() or self.interface.isNamespace() or self.hasDescendants() return (self.interface.isCallback() or self.interface.isNamespace() or
self.hasDescendants() or self.interface.getExtendedAttribute("HTMLConstructor"))
def shouldCacheConstructor(self):
return self.hasDescendants() or self.interface.getExtendedAttribute("HTMLConstructor")
def isExposedConditionally(self): def isExposedConditionally(self):
return self.interface.isExposedConditionally() return self.interface.isExposedConditionally()