rv = NS_AutoregisterComponents(); if (NS_FAILED(rv)) return rv;
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 = NS_OK;    if (argc < 4) {        printf("usage: %s int (loop count) baseURL relativeSpec\n", argv[0]);        return -1;    }    PRUint32 cycles = atoi(argv[1]);    char *base = argv[2];    char *rel  = argv[3];    rv = NS_AutoregisterComponents();    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIIOService> serv(do_GetService(kIOServiceCID, &rv));    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIURI> uri;    rv = serv->NewURI(base, nsnull, getter_AddRefs(uri));    if (NS_FAILED(rv)) return rv;    char *absURLString;    PRUint32 i = 0;    while (i++ < cycles) {        rv = ServiceMakeAbsolute(uri, rel, &absURLString);        if (NS_FAILED(rv)) return rv;        nsMemory::Free(absURLString);        rv = URLMakeAbsolute(uri, rel, &absURLString);        nsMemory::Free(absURLString);    }    return rv;}