Exemplo n.º 1
0
def _add_xpcom_blob(built_in_blob):
    global _g_xpcom_components_elem
    global _g_xpcom_interfaces_elem
    if _xpcom_:
        if _g_xpcom_components_elem is None:
            # create the blob to hold xpcom data
            #print "Building xpcom cix wrapper for the first time"
            _g_xpcom_components_elem = SubElement(built_in_blob, "variable",
                                         citdl="Object", name="Components")
            xpcComponents = iid_to_cix("nsIXPCComponents")

            elem_classes = None
            for elem in xpcComponents:
                if elem.get("name") == "classes":
                    #print "Found the classes elem: %r" % (elem, )
                    elem.attrib["citdl"] = "Object"
                    elem_classes = elem
                elif elem.get("name") == "interfaces":
                    #print "Found the interfaces elem: %r" % (elem, )
                    elem.attrib["citdl"] = "Object"
                    _g_xpcom_interfaces_elem = elem
                _g_xpcom_components_elem.append(elem)
    
            # Add Components.interfaces data
            for interface in components.interfaces.keys():
                elem = SubElement(_g_xpcom_interfaces_elem, "scope",
                                  ilk="class", name=interface)
    
            # Add Components.classes data
            for klass in components.classes.keys():
                elem = SubElement(elem_classes, "variable", name=klass)
    
            # Add some common aliases
            for alias_name in ("CI", "Ci", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.interfaces", name=alias_name)
            for alias_name in ("CC", "Cc", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.classes", name=alias_name)
            for alias_name in ("CU", "Cu", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.utils", name=alias_name)
        # This check is necessary as sometimes a blob will be cached and
        # will already contain the Components elem.
        elif built_in_blob.names.get("Components") is None:
            built_in_blob.append(_g_xpcom_components_elem)
Exemplo n.º 2
0
def _add_xpcom_blob(built_in_blob):
    global _g_xpcom_components_elem
    global _g_xpcom_interfaces_elem
    if _xpcom_:
        if _g_xpcom_components_elem is None:
            # create the blob to hold xpcom data
            #print "Building xpcom cix wrapper for the first time"
            _g_xpcom_components_elem = SubElement(built_in_blob, "variable",
                                         citdl="Object", name="Components")
            xpcComponents = iid_to_cix("nsIXPCComponents")

            elem_classes = None
            for elem in xpcComponents:
                if elem.get("name") == "classes":
                    #print "Found the classes elem: %r" % (elem, )
                    elem.attrib["citdl"] = "Object"
                    elem_classes = elem
                elif elem.get("name") == "interfaces":
                    #print "Found the interfaces elem: %r" % (elem, )
                    elem.attrib["citdl"] = "Object"
                    _g_xpcom_interfaces_elem = elem
                _g_xpcom_components_elem.append(elem)
    
            # Add Components.interfaces data
            for interface in components.interfaces.keys():
                elem = SubElement(_g_xpcom_interfaces_elem, "scope",
                                  ilk="class", name=interface)
    
            # Add Components.classes data
            for klass in components.classes.keys():
                elem = SubElement(elem_classes, "variable", name=klass)
    
            # Add some common aliases
            for alias_name in ("CI", "Ci", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.interfaces", name=alias_name)
            for alias_name in ("CC", "Cc", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.classes", name=alias_name)
            for alias_name in ("CU", "Cu", ):
                SubElement(built_in_blob, "variable",
                           citdl="Components.utils", name=alias_name)
        # This check is necessary as sometimes a blob will be cached and
        # will already contain the Components elem.
        elif built_in_blob.names.get("Components") is None:
            built_in_blob.append(_g_xpcom_components_elem)