rv = nsServiceManager::GetService(kXULSortServiceCID, NS_GET_IID(nsIXULSortService), (nsISupports**) &gXULSortService); if (NS_FAILED(rv)) return rv;
rv = CallGetService(kHTMLElementFactoryCID, &gHTMLElementFactory); if (NS_FAILED(rv)) return rv;
nsXULContentBuilder::Init(){    if (gRefCnt++ == 0) {        nsresult rv;        rv = nsServiceManager::GetService(kXULSortServiceCID,                                          NS_GET_IID(nsIXULSortService),                                          (nsISupports**) &gXULSortService);        if (NS_FAILED(rv)) return rv;        rv = nsComponentManager::CreateInstance(kHTMLElementFactoryCID,                                                nsnull,                                                NS_GET_IID(nsIElementFactory),                                                (void**) &gHTMLElementFactory);        if (NS_FAILED(rv)) return rv;        rv = nsComponentManager::CreateInstance(kXMLElementFactoryCID,                                                nsnull,                                                NS_GET_IID(nsIElementFactory),                                                (void**) &gXMLElementFactory);        if (NS_FAILED(rv)) return rv;    }    return nsXULTemplateBuilder::Init();}