rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, "components");
rv = NS_AutoregisterComponents();
main(int argc, char* argv[]){    nsresult rv= -1;    if (argc < 2) {        printf("usage: %s <url> \n", argv[0]);        return -1;    }    /*       The following code only deals with XPCOM registration stuff. and setting      up the event queues. Copied from TestSocketIO.cpp    */    // XXX why do I have to do this?!    rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,                                          "components");    if (NS_FAILED(rv)) return rv;        // Create the Event Queue for this thread...    NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);    if (NS_FAILED(rv)) return rv;    rv = eventQService->CreateThreadEventQueue();    if (NS_FAILED(rv)) return rv;    eventQService->GetThreadEventQueue(PR_CurrentThread(), &gEventQ);    int i;    for (i=1; i<argc; i++) {        rv = StartLoadingURL(argv[i]);        if (NS_FAILED(rv)) return rv;    }  // Enter the message pump to allow the URL load to proceed.    while ( gKeepRunning ) {#ifdef WIN32        MSG msg;        if (GetMessage(&msg, NULL, 0, 0)) {            TranslateMessage(&msg);            DispatchMessage(&msg);        } else {            gKeepRunning = FALSE;    }#else#ifdef XP_MAC    /* Mac stuff is missing here! */#else    PLEvent *gEvent;    rv = gEventQ->GetEvent(&gEvent);    rv = gEventQ->HandleEvent(gEvent);#endif /* XP_UNIX */#endif /* !WIN32 */    }    return rv;}