Bug 1270349 part 3. Add a way to ask an interface descriptor for a proxy whether its named props should be enumerable. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 09 May 2016 22:25:40 -0400
changeset 365164 4a29d3bb1b6b4ed4b56608e4c4fab406e8e0b0d1
parent 365163 a3361d3f04b345eda3605b45f325c0987083dd06
child 365165 db1255660184afab1d0b1a490a709ecfba770a62
push id17650
push usermartin.thomson@gmail.com
push dateTue, 10 May 2016 05:06:10 +0000
reviewerspeterv
bugs1270349
milestone49.0a1
Bug 1270349 part 3. Add a way to ask an interface descriptor for a proxy whether its named props should be enumerable. r=peterv
dom/bindings/Configuration.py
--- a/dom/bindings/Configuration.py
+++ b/dom/bindings/Configuration.py
@@ -805,16 +805,30 @@ class Descriptor(DescriptorProvider):
     def isGlobal(self):
         """
         Returns true if this is the primary interface for a global object
         of some sort.
         """
         return (self.interface.getExtendedAttribute("Global") or
                 self.interface.getExtendedAttribute("PrimaryGlobal"))
 
+    @property
+    def namedPropertiesEnumerable(self):
+        """
+        Returns whether this interface should have enumerable named properties
+        """
+        assert self.proxy
+        assert self.supportsNamedProperties()
+        iface = self.interface
+        while iface:
+            if iface.getExtendedAttribute("LegacyUnenumerableNamedProperties"):
+                return False
+            iface = iface.parent
+        return True
+
 
 # Some utility methods
 def getTypesFromDescriptor(descriptor):
     """
     Get all argument and return types for all members of the descriptor
     """
     members = [m for m in descriptor.interface.members]
     if descriptor.interface.ctor():