Bug 676857 - Make it an error if interfaces have too many methods.
authorJoshua Cranmer <Pidgeot18@gmail.com>
Fri, 05 Aug 2011 11:34:13 -0700
changeset 76280 16107d1404233e9cea93ae542a6204a02b6baa8d
parent 76279 55d5d141c68df188cfd0a2b5d2acab6e5936e2e4
child 76281 40007fc40e9606bca9aa0e767a5d7d46b3244677
push id67
push userclegnitto@mozilla.com
push dateFri, 04 Nov 2011 22:39:41 +0000
treeherdermozilla-release@04778346a3b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs676857
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 676857 - Make it an error if interfaces have too many methods. The error is made at compile-time, and also causes an error if trying to make a stub like this. Finally, it also refuses to load such an interface. These restrictions only apply to script-implementable interfaces.
dom/interfaces/css/nsIDOMCSS2Properties.idl
xpcom/idl-parser/xpidl.py
xpcom/idl-parser/xpidlyacc.py
xpcom/reflect/xptcall/public/genstubs.pl
xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
--- a/dom/interfaces/css/nsIDOMCSS2Properties.idl
+++ b/dom/interfaces/css/nsIDOMCSS2Properties.idl
@@ -46,17 +46,17 @@
  * The nsIDOMCSS2Properties interface is a datatype for additional
  * reflection of data already provided in nsIDOMCSSStyleDeclaration in
  * the Document Object Model.
  *
  * For more information on this interface please see
  * http://www.w3.org/TR/DOM-Level-2-Style
  */
 
-[scriptable, uuid(10f43750-b379-11e0-aff2-0800200c9a66)]
+[builtinclass, scriptable, uuid(10f43750-b379-11e0-aff2-0800200c9a66)]
 interface nsIDOMCSS2Properties : nsISupports
 {
            attribute DOMString        background;
                                         // raises(DOMException) on setting
 
            attribute DOMString        backgroundAttachment;
                                         // raises(DOMException) on setting
 
--- a/xpcom/idl-parser/xpidl.py
+++ b/xpcom/idl-parser/xpidl.py
@@ -337,16 +337,19 @@ class CDATA(object):
         self.location = location
 
     def resolve(self, parent):
         pass
 
     def __str__(self):
         return "cdata: %s\n\t%r\n" % (self.location.get(), self.data)
 
+    def count(self):
+        return 0
+
 class Typedef(object):
     kind = 'typedef'
 
     def __init__(self, type, name, location, doccomments):
         self.type = type
         self.name = name
         self.location = location
         self.doccomments = doccomments
@@ -525,16 +528,24 @@ class Interface(object):
                 raise IDLError("interface '%s' inherits from non-interface type '%s'" % (self.name, self.base), self.location)
 
             if self.attributes.scriptable and not realbase.attributes.scriptable:
                 print >>sys.stderr, IDLError("interface '%s' is scriptable but derives from non-scriptable '%s'" % (self.name, self.base), self.location, warning=True)
 
         for member in self.members:
             member.resolve(self)
 
+        # The number 250 is NOT arbitrary; this number is the maximum number of
+        # stub entries defined in xpcom/reflect/xptcall/public/genstubs.pl
+        # Do not increase this value without increasing the number in that
+        # location, or you WILL cause otherwise unknown problems!
+        if self.countEntries() > 250 and not self.attributes.builtinclass:
+            raise IDLError("interface '%s' has too many entries" % self.name,
+                self.location)
+
     def isScriptable(self):
         # NOTE: this is not whether *this* interface is scriptable... it's
         # whether, when used as a type, it's scriptable, which is true of all
         # interfaces.
         return True
 
     def nativeType(self, calltype, const=False):
         return "%s%s %s" % (const and 'const ' or '',
@@ -563,16 +574,24 @@ class Interface(object):
     def needsJSTypes(self):
         for m in self.members:
             if m.kind == "attribute" and m.type == "jsval":
                 return True
             if m.kind == "method" and m.needsJSTypes():
                 return True
         return False
 
+    def countEntries(self):
+        ''' Returns the number of entries in the vtable for this interface. '''
+        total = sum(member.count() for member in self.members)
+        if self.base is not None:
+            realbase = self.idl.getName(self.base, self.location)
+            total += realbase.countEntries()
+        return total
+
 class InterfaceAttributes(object):
     uuid = None
     scriptable = False
     builtinclass = False
     function = False
     deprecated = False
     noscript = False
 
@@ -659,16 +678,19 @@ class ConstMember(object):
         self.basetype = basetype
 
     def getValue(self):
         return self.value(self.iface)
 
     def __str__(self):
         return "\tconst %s %s = %s\n" % (self.type, self.name, self.getValue())
 
+    def count(self):
+        return 0
+
 class Attribute(object):
     kind = 'attribute'
     noscript = False
     notxpcom = False
     readonly = False
     implicit_jscontext = False
     nostdcall = False
     binaryname = None
@@ -750,16 +772,19 @@ class Attribute(object):
     def isScriptable(self):
         if not self.iface.attributes.scriptable: return False
         return not (self.noscript or self.notxpcom)
 
     def __str__(self):
         return "\t%sattribute %s %s\n" % (self.readonly and 'readonly ' or '',
                                           self.type, self.name)
 
+    def count(self):
+        return self.readonly and 1 or 2
+
 class Method(object):
     kind = 'method'
     noscript = False
     notxpcom = False
     binaryname = None
     implicit_jscontext = False
     nostdcall = False
     optional_argc = False
@@ -835,16 +860,19 @@ class Method(object):
         if self.implicit_jscontext:
             return True
         for p in self.params:
             t = p.realtype
             if isinstance(t, Native) and t.specialtype == "jsval":
                 return True
         return False
 
+    def count(self):
+        return 1
+
 class Param(object):
     size_is = None
     iid_is = None
     const = False
     array = False
     retval = False
     shared = False
     optional = False
--- a/xpcom/idl-parser/xpidlyacc.py
+++ b/xpcom/idl-parser/xpidlyacc.py
@@ -1,10 +1,10 @@
 
-# /home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidlyacc.py
+# /src/trunk/mozilla/xpcom/idl-parser/xpidlyacc.py
 # This file is automatically generated. Do not edit.
 _tabversion = '3.2'
 
 _lr_method = 'LALR'
 
 _lr_signature = ',Q\xe7:m\xcf|\xa4\x8ad\x0f\x06\xc1Q\x1f\x99'
     
 _lr_action_items = {'CONST':([6,25,42,47,48,82,84,104,],[14,14,45,45,-28,-29,-41,-42,]),'NATIVEID':([43,],[50,]),'NUMBER':([62,65,66,77,78,79,80,81,83,],[68,68,68,68,68,68,68,68,68,]),'LSHIFT':([67,68,69,70,75,76,92,93,94,95,96,97,98,],[80,-30,-32,-31,80,-34,-33,-35,-37,-36,-38,-39,80,]),'RSHIFT':([67,68,69,70,75,76,92,93,94,95,96,97,98,],[81,-30,-32,-31,81,-34,-33,-35,-37,-36,-38,-39,81,]),'INOUT':([28,64,74,85,],[-13,-14,90,-14,]),'NATIVE':([0,2,5,7,8,9,10,28,31,44,61,],[-14,-14,-14,-14,-14,-14,23,-13,-8,-21,-9,]),')':([33,34,50,64,68,69,70,72,73,75,76,86,92,93,94,95,96,97,98,99,103,106,107,108,111,],[38,39,57,-44,-30,-32,-31,-45,87,92,-34,-43,-33,-35,-37,-36,-38,-39,-40,-45,-46,-47,109,-55,-56,]),'(':([14,16,17,30,37,60,62,65,66,77,78,79,80,81,83,101,],[-12,27,-11,-10,43,64,65,65,65,65,65,65,65,65,65,105,]),'+':([67,68,69,70,75,76,92,93,94,95,96,97,98,],[77,-30,-32,-31,77,-34,-33,-35,-37,-36,77,77,77,]),'*':([67,68,69,70,75,76,92,93,94,95,96,97,98,],[78,-30,-32,-31,78,-34,-33,78,-37,78,78,78,78,]),'-':([62,65,66,67,68,69,70,75,76,77,78,79,80,81,83,92,93,94,95,96,97,98,],[66,66,66,79,-30,-32,-31,79,-34,66,66,66,66,66,66,-33,-35,-37,-36,79,79,79,]),',':([14,15,16,17,26,38,39,72,99,106,108,],[-12,25,-20,-11,-17,-18,-19,85,85,-47,110,]),'IID':([27,],[34,]),'READONLY':([28,42,47,48,49,82,84,104,],[-13,-14,-14,-28,55,-29,-41,-42,]),';':([24,29,36,40,41,52,57,67,68,69,70,71,76,87,92,93,94,95,96,97,98,100,109,],[31,-25,-23,-24,44,-22,61,82,-30,-32,-31,84,-34,-54,-33,-35,-37,-36,-38,-39,-40,104,-53,]),'IDENTIFIER':([3,6,12,22,23,25,27,28,35,42,45,47,48,49,51,56,59,62,63,65,66,77,78,79,80,81,82,83,84,88,89,90,91,102,104,105,110,],[12,17,24,29,30,17,33,-13,40,-14,51,-14,-28,56,58,60,63,69,71,69,69,69,69,69,69,69,-29,69,-41,102,-48,-49,-50,106,-42,108,108,]),'=':([58,],[62,]),'OUT':([28,64,74,85,],[-13,-14,91,-14,]),'TYPEDEF':([0,2,5,7,8,9,31,44,61,],[3,3,3,3,3,3,-8,-21,-9,]),'RAISES':([87,],[101,]),'IN':([28,64,74,85,],[-13,-14,89,-14,]),'[':([0,2,5,7,8,9,31,42,44,47,48,61,64,82,84,85,104,],[6,6,6,6,6,6,-8,6,-21,6,-28,-9,6,-29,-41,6,-42,]),'INCLUDE':([0,2,5,7,8,9,31,44,61,],[7,7,7,7,7,7,-8,-21,-9,]),']':([14,15,16,17,18,26,32,38,39,],[-12,-15,-20,-11,28,-17,-16,-18,-19,]),':':([29,],[35,]),'ATTRIBUTE':([28,42,47,48,49,54,55,82,84,104,],[-13,-14,-14,-28,-52,59,-51,-29,-41,-42,]),'CDATA':([0,2,5,7,8,9,31,42,44,47,48,61,82,84,104,],[9,9,9,9,9,9,-8,48,-21,48,-28,-9,-29,-41,-42,]),'INTERFACE':([0,2,5,7,8,9,10,28,31,44,61,],[-14,-14,-14,-14,-14,-14,22,-13,-8,-21,-9,]),'{':([29,36,40,],[-25,42,-24,]),'$end':([0,1,2,4,5,7,8,9,11,13,19,20,21,31,44,61,],[-2,-1,-2,0,-2,-2,-2,-2,-6,-5,-4,-7,-3,-8,-21,-9,]),'}':([42,46,47,48,53,82,84,104,],[-26,52,-26,-28,-27,-29,-41,-42,]),'|':([67,68,69,70,75,76,92,93,94,95,96,97,98,],[83,-30,-32,-31,83,-34,-33,-35,-37,-36,-38,-39,-40,]),'HEXNUM':([62,65,66,77,78,79,80,81,83,],[70,70,70,70,70,70,70,70,70,]),}
@@ -21,65 +21,65 @@ del _lr_action_items
 _lr_goto = { }
 for _k, _v in _lr_goto_items.items():
    for _x,_y in zip(_v[0],_v[1]):
        if not _x in _lr_goto: _lr_goto[_x] = { }
        _lr_goto[_x][_k] = _y
 del _lr_goto_items
 _lr_productions = [
   ("S' -> idlfile","S'",1,None,None,None),
-  ('idlfile -> productions','idlfile',1,'p_idlfile','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1028),
-  ('productions -> <empty>','productions',0,'p_productions_start','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1032),
-  ('productions -> CDATA productions','productions',2,'p_productions_cdata','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1036),
-  ('productions -> INCLUDE productions','productions',2,'p_productions_include','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1041),
-  ('productions -> interface productions','productions',2,'p_productions_interface','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1046),
-  ('productions -> typedef productions','productions',2,'p_productions_interface','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1047),
-  ('productions -> native productions','productions',2,'p_productions_interface','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1048),
-  ('typedef -> TYPEDEF IDENTIFIER IDENTIFIER ;','typedef',4,'p_typedef','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1053),
-  ('native -> attributes NATIVE IDENTIFIER afternativeid ( NATIVEID ) ;','native',8,'p_native','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1060),
-  ('afternativeid -> <empty>','afternativeid',0,'p_afternativeid','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1067),
-  ('anyident -> IDENTIFIER','anyident',1,'p_anyident','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1073),
-  ('anyident -> CONST','anyident',1,'p_anyident','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1074),
-  ('attributes -> [ attlist ]','attributes',3,'p_attributes','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1079),
-  ('attributes -> <empty>','attributes',0,'p_attributes','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1080),
-  ('attlist -> attribute','attlist',1,'p_attlist_start','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1088),
-  ('attlist -> attribute , attlist','attlist',3,'p_attlist_continue','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1092),
-  ('attribute -> anyident attributeval','attribute',2,'p_attribute','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1097),
-  ('attributeval -> ( IDENTIFIER )','attributeval',3,'p_attributeval','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1101),
-  ('attributeval -> ( IID )','attributeval',3,'p_attributeval','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1102),
-  ('attributeval -> <empty>','attributeval',0,'p_attributeval','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1103),
-  ('interface -> attributes INTERFACE IDENTIFIER ifacebase ifacebody ;','interface',6,'p_interface','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1108),
-  ('ifacebody -> { members }','ifacebody',3,'p_ifacebody','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1137),
-  ('ifacebody -> <empty>','ifacebody',0,'p_ifacebody','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1138),
-  ('ifacebase -> : IDENTIFIER','ifacebase',2,'p_ifacebase','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1143),
-  ('ifacebase -> <empty>','ifacebase',0,'p_ifacebase','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1144),
-  ('members -> <empty>','members',0,'p_members_start','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1149),
-  ('members -> member members','members',2,'p_members_continue','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1153),
-  ('member -> CDATA','member',1,'p_member_cdata','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1158),
-  ('member -> CONST IDENTIFIER IDENTIFIER = number ;','member',6,'p_member_const','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1162),
-  ('number -> NUMBER','number',1,'p_number_decimal','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1170),
-  ('number -> HEXNUM','number',1,'p_number_hex','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1175),
-  ('number -> IDENTIFIER','number',1,'p_number_identifier','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1180),
-  ('number -> ( number )','number',3,'p_number_paren','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1186),
-  ('number -> - number','number',2,'p_number_neg','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1190),
-  ('number -> number + number','number',3,'p_number_add','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1195),
-  ('number -> number - number','number',3,'p_number_add','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1196),
-  ('number -> number * number','number',3,'p_number_add','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1197),
-  ('number -> number LSHIFT number','number',3,'p_number_shift','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1208),
-  ('number -> number RSHIFT number','number',3,'p_number_shift','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1209),
-  ('number -> number | number','number',3,'p_number_bitor','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1218),
-  ('member -> attributes optreadonly ATTRIBUTE IDENTIFIER IDENTIFIER ;','member',6,'p_member_att','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1224),
-  ('member -> attributes IDENTIFIER IDENTIFIER ( paramlist ) raises ;','member',8,'p_member_method','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1240),
-  ('paramlist -> param moreparams','paramlist',2,'p_paramlist','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1255),
-  ('paramlist -> <empty>','paramlist',0,'p_paramlist','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1256),
-  ('moreparams -> <empty>','moreparams',0,'p_moreparams_start','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1264),
-  ('moreparams -> , param moreparams','moreparams',3,'p_moreparams_continue','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1268),
-  ('param -> attributes paramtype IDENTIFIER IDENTIFIER','param',4,'p_param','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1273),
-  ('paramtype -> IN','paramtype',1,'p_paramtype','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1281),
-  ('paramtype -> INOUT','paramtype',1,'p_paramtype','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1282),
-  ('paramtype -> OUT','paramtype',1,'p_paramtype','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1283),
-  ('optreadonly -> READONLY','optreadonly',1,'p_optreadonly','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1287),
-  ('optreadonly -> <empty>','optreadonly',0,'p_optreadonly','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1288),
-  ('raises -> RAISES ( idlist )','raises',4,'p_raises','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1295),
-  ('raises -> <empty>','raises',0,'p_raises','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1296),
-  ('idlist -> IDENTIFIER','idlist',1,'p_idlist','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1303),
-  ('idlist -> IDENTIFIER , idlist','idlist',3,'p_idlist_continue','/home/khuey/dev/mozilla-central/xpcom/idl-parser/xpidl.py',1307),
+  ('idlfile -> productions','idlfile',1,'p_idlfile','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1055),
+  ('productions -> <empty>','productions',0,'p_productions_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1059),
+  ('productions -> CDATA productions','productions',2,'p_productions_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1063),
+  ('productions -> INCLUDE productions','productions',2,'p_productions_include','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1068),
+  ('productions -> interface productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1073),
+  ('productions -> typedef productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1074),
+  ('productions -> native productions','productions',2,'p_productions_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1075),
+  ('typedef -> TYPEDEF IDENTIFIER IDENTIFIER ;','typedef',4,'p_typedef','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1080),
+  ('native -> attributes NATIVE IDENTIFIER afternativeid ( NATIVEID ) ;','native',8,'p_native','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1087),
+  ('afternativeid -> <empty>','afternativeid',0,'p_afternativeid','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1094),
+  ('anyident -> IDENTIFIER','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1100),
+  ('anyident -> CONST','anyident',1,'p_anyident','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1101),
+  ('attributes -> [ attlist ]','attributes',3,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1106),
+  ('attributes -> <empty>','attributes',0,'p_attributes','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1107),
+  ('attlist -> attribute','attlist',1,'p_attlist_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1115),
+  ('attlist -> attribute , attlist','attlist',3,'p_attlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1119),
+  ('attribute -> anyident attributeval','attribute',2,'p_attribute','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1124),
+  ('attributeval -> ( IDENTIFIER )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1128),
+  ('attributeval -> ( IID )','attributeval',3,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1129),
+  ('attributeval -> <empty>','attributeval',0,'p_attributeval','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1130),
+  ('interface -> attributes INTERFACE IDENTIFIER ifacebase ifacebody ;','interface',6,'p_interface','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1135),
+  ('ifacebody -> { members }','ifacebody',3,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1164),
+  ('ifacebody -> <empty>','ifacebody',0,'p_ifacebody','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1165),
+  ('ifacebase -> : IDENTIFIER','ifacebase',2,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1170),
+  ('ifacebase -> <empty>','ifacebase',0,'p_ifacebase','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1171),
+  ('members -> <empty>','members',0,'p_members_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1176),
+  ('members -> member members','members',2,'p_members_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1180),
+  ('member -> CDATA','member',1,'p_member_cdata','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1185),
+  ('member -> CONST IDENTIFIER IDENTIFIER = number ;','member',6,'p_member_const','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1189),
+  ('number -> NUMBER','number',1,'p_number_decimal','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1197),
+  ('number -> HEXNUM','number',1,'p_number_hex','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1202),
+  ('number -> IDENTIFIER','number',1,'p_number_identifier','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1207),
+  ('number -> ( number )','number',3,'p_number_paren','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1213),
+  ('number -> - number','number',2,'p_number_neg','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1217),
+  ('number -> number + number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1222),
+  ('number -> number - number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1223),
+  ('number -> number * number','number',3,'p_number_add','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1224),
+  ('number -> number LSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1235),
+  ('number -> number RSHIFT number','number',3,'p_number_shift','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1236),
+  ('number -> number | number','number',3,'p_number_bitor','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1245),
+  ('member -> attributes optreadonly ATTRIBUTE IDENTIFIER IDENTIFIER ;','member',6,'p_member_att','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1251),
+  ('member -> attributes IDENTIFIER IDENTIFIER ( paramlist ) raises ;','member',8,'p_member_method','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1267),
+  ('paramlist -> param moreparams','paramlist',2,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1282),
+  ('paramlist -> <empty>','paramlist',0,'p_paramlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1283),
+  ('moreparams -> <empty>','moreparams',0,'p_moreparams_start','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1291),
+  ('moreparams -> , param moreparams','moreparams',3,'p_moreparams_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1295),
+  ('param -> attributes paramtype IDENTIFIER IDENTIFIER','param',4,'p_param','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1300),
+  ('paramtype -> IN','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1308),
+  ('paramtype -> INOUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1309),
+  ('paramtype -> OUT','paramtype',1,'p_paramtype','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1310),
+  ('optreadonly -> READONLY','optreadonly',1,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1314),
+  ('optreadonly -> <empty>','optreadonly',0,'p_optreadonly','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1315),
+  ('raises -> RAISES ( idlist )','raises',4,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1322),
+  ('raises -> <empty>','raises',0,'p_raises','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1323),
+  ('idlist -> IDENTIFIER','idlist',1,'p_idlist','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1330),
+  ('idlist -> IDENTIFIER , idlist','idlist',3,'p_idlist_continue','/src/trunk/mozilla/xpcom/idl-parser/xpidl.py',1334),
 ]
--- a/xpcom/reflect/xptcall/public/genstubs.pl
+++ b/xpcom/reflect/xptcall/public/genstubs.pl
@@ -3,22 +3,24 @@
 # This is used to generate stub entry points. We generate a file to
 # be included in the declaraion and a file to be used for expanding macros
 # to represent the implementation of the stubs.
 
 #
 # if "$entry_count" is ever changed and the .inc files regenerated then
 # the following issues need to be addressed:
 #
-# 1) Alpha NT has a .def file that lists exports by symbol. It will need
-#    updating.
-# 2) The current Linux ARM code has a limitation of only having 256-3 stubs
+# 1) The current Linux ARM code has a limitation of only having 256-3 stubs,
+#    as a result of the limitations of immediate values in ARM assembly.
 #
-# more dependencies???
-#
+# This number is verified by the IDL parser in xpcom/idl-parser/xpidl.py, as
+# well as in xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp, to
+# prevent generating interfaces or loading xpt files that would cause the
+# stubs to run off the entries.
+# If you change this number, please update that location.
 
 # 3 entries are already 'used' by the 3 methods of nsISupports.
 # 3+247+5=255 This should get us in under the Linux ARM limitation
 $entry_count    = 247;
 $sentinel_count = 5;
 
 $decl_name = "xptcstubsdecl.inc";
 $def_name  = "xptcstubsdef.inc";
--- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
+++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
@@ -248,16 +248,26 @@ xptiInterfaceInfoManager::RegisterInputS
 
 void
 xptiInterfaceInfoManager::VerifyAndAddEntryIfNew(XPTInterfaceDirectoryEntry* iface,
                                                  PRUint16 idx,
                                                  xptiTypelibGuts* typelib)
 {
     if (!iface->interface_descriptor)
         return;
+
+    // The number of maximum methods is not arbitrary. It is the same value as
+    // in xpcom/reflect/xptcall/public/genstubs.pl; do not change this value
+    // without changing that one or you WILL see problems.
+    if (iface->interface_descriptor->num_methods > 250 &&
+            !(XPT_ID_IS_BUILTINCLASS(iface->interface_descriptor->flags))) {
+        NS_ASSERTION(0, "Too many methods to handle for the stub, cannot load");
+        fprintf(stderr, "ignoring too large interface: %s\n", iface->name);
+        return;
+    }
     
     mWorkingSet.mTableReentrantMonitor.AssertCurrentThreadIn();
     xptiInterfaceEntry* entry = mWorkingSet.mIIDTable.Get(iface->iid);
     if (entry) {
         // XXX validate this info to find possible inconsistencies
         LOG_AUTOREG(("      ignoring repeated interface: %s\n", iface->name));
         return;
     }