Bug 1267369 - Only generate typelib data for scriptable interfaces; r?khuey draft
authorGregory Szorc <gps@mozilla.com>
Mon, 25 Apr 2016 12:32:10 -0700
changeset 356131 2709df07a12ff5ff965764479a9bc07bbb97484e
parent 356118 1da5ed6cb548ab1b7b717c4d27e7ebb6930e08d7
child 519343 337bd09dd0b81268f83f58d686c30c4b1f8fe36e
push id16449
push usergszorc@mozilla.com
push dateMon, 25 Apr 2016 19:32:41 +0000
reviewerskhuey
bugs1267369
milestone48.0a1
Bug 1267369 - Only generate typelib data for scriptable interfaces; r?khuey We are currently generating typelib data for all interfaces. Apparently typelib data is only needed for scriptable interfaces. So let's stop generating typelib data for interfaces that aren't scriptable. The impact of this is that some typelibs are dropped from interfaces.xpt, resulting in ~10kb smaller interfaces.xpt: * nsIDOMCSSValue * nsIDOMDOMImplementation * nsIDOMDOMCursor * nsIProfilerStartParams * nsIStreamingProtocolMetaData * nsIDOMCharacterData * nsIPrintSession * nsIDOMDocumentFragment * nsIDOMProcessingInstruction * nsIDOMElement * nsIDOMText * nsIDOMXULElement * nsIDOMAttr * nsIDOMGeoPositionError * nsIXMLHttpRequestEventTarget * nsIDOMCSSStyleDeclaration * nsIDOMCSSStyleSheet * nsIDOMDocument * nsIDOMClientRect * nsIDOMMozNamedAttrMap * nsIDOMNode * nsIThreadObserver * nsIDOMDocumentType * nsIXMLHttpRequestUpload * nsISelection * nsIDOMCDATASection * nsIDOMDOMRequest * nsIDOMComment * nsIDOMEvent MozReview-Commit-ID: 3LYdNYs7Tum
xpcom/idl-parser/xpidl/typelib.py
--- a/xpcom/idl-parser/xpidl/typelib.py
+++ b/xpcom/idl-parser/xpidl/typelib.py
@@ -237,20 +237,20 @@ def build_interface(iface, ifaces):
                          function=iface.attributes.function,
                          builtinclass=iface.attributes.builtinclass,
                          main_process_scriptable_only=iface.attributes.main_process_scriptable_only)
 
 
 def write_typelib(idl, fd, filename):
     """ Generate the typelib. """
 
-    # We only care about interfaces
+    # We only care about interfaces that are scriptable.
     ifaces = []
     for p in idl.productions:
-        if p.kind == 'interface':
+        if p.kind == 'interface' and p.attributes.scriptable:
             ifaces.append(build_interface(p, ifaces))
 
     typelib = xpt.Typelib(interfaces=ifaces)
     typelib.writefd(fd)
 
 if __name__ == '__main__':
     from optparse import OptionParser
     o = OptionParser()