rv = NS_AutoregisterComponents(); NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't register XPCOM components");
nsCOMPtr<nsIServiceManager> servMan; NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull); nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan); NS_ASSERTION(registrar, "Null nsIComponentRegistrar"); registrar->AutoRegister(nsnull);
main(int argc, char* argv[]){    nsresult rv;    nsCOMPtr<nsINetDataCacheManager> cache;    rv = NS_AutoregisterComponents();    NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't register XPCOM components");    rv = nsComponentManager::CreateInstance(NS_NETWORK_CACHE_MANAGER_CONTRACTID,                                            nsnull,                                            NS_GET_IID(nsINetDataCacheManager),                                            getter_AddRefs(cache));    NS_ASSERTION(NS_SUCCEEDED(rv), "Couldn't create cache manager factory") ;    cache->SetDiskCacheCapacity(DISK_CACHE_CAPACITY);    cache->SetMemCacheCapacity(MEM_CACHE_CAPACITY);    InitQueue();        Test(cache, nsINetDataCacheManager::BYPASS_PERSISTENT_CACHE, MEM_CACHE_CAPACITY);    Test(cache, nsINetDataCacheManager::BYPASS_MEMORY_CACHE, DISK_CACHE_CAPACITY);    return 0;}