rv = NS_AutoregisterComponents();
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;    rv = NS_AutoregisterComponents();    NS_ASSERTION(NS_SUCCEEDED(rv), "AutoregisterComponents failed");    if (argc < 2) {        printf("usage: %s resource://foo/<path-to-resolve>\n", argv[0]);        return -1;    }    rv = SetupMapping();    NS_ASSERTION(NS_SUCCEEDED(rv), "SetupMapping failed");    if (NS_FAILED(rv)) return rv;    rv = TestOpenInputStream(argv[1]);    NS_ASSERTION(NS_SUCCEEDED(rv), "TestOpenInputStream failed");    rv = TestAsyncRead(argv[1]);    NS_ASSERTION(NS_SUCCEEDED(rv), "TestAsyncRead failed");    return rv;}