nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, "./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);
int main(int argc, char **argv){    nsAutoString url_address;//    char buf[256];//    nsIStreamListener *pConsumer;    nsIEventQueueService* pEventQService;//    nsIURL *pURL;    nsresult result;    int i;    if (argc < 2) {        printf("urltest: <URL> \n");        return 0;    }    nsComponentManager::AutoRegister(nsIComponentManagerObsolete::NS_Startup, "./components");    testURL(argv[1]);    return 0;#if 0    nsRepository::RegisterComponent(		kEventQueueServiceCID, NULL, NULL, XPCOM_DLL, PR_FALSE, PR_FALSE);    nsRepository::RegisterComponent(		kNetServiceCID, NULL, NULL, NETLIB_DLL, PR_FALSE, PR_FALSE);    // Create the Event Queue for this thread...    pEventQService = nsnull;    result = nsServiceManager::GetService(kEventQueueServiceCID,                                          kIEventQueueServiceIID,                                          (nsISupports **)&pEventQService);    if (NS_SUCCEEDED(result)) {      // XXX: What if this fails?      result = pEventQService->CreateThreadEventQueue();    }    for (i=1; i < argc; i++) {        if (PL_strcasecmp(argv[i], "-all") == 0) {            testURL(0);            continue;        }         testURL(argv[i]);    }    if (nsnull != pEventQService) {        pEventQService->DestroyThreadEventQueue();        nsServiceManager::ReleaseService(kEventQueueServiceCID, pEventQService);    }    return 0;#endif}