PLEvent *gEvent; gEventQ->WaitForEvent(&gEvent); gEventQ->HandleEvent(gEvent);
int main(int argc, char *argv[]) {    nsresult rv = NS_OK;    PRBool cmdLineURL = PR_FALSE;    if (argc > 1) {        // run in signle url mode        cmdLineURL = PR_TRUE;    }    rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);    if (NS_FAILED(rv)) return rv;    // Create the Event Queue for this thread...    nsCOMPtr<nsIEventQueueService> eventQService =              do_GetService(kEventQueueServiceCID, &rv);    if (NS_FAILED(rv)) return rv;    rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ);    if (NS_FAILED(rv)) return rv;    if (cmdLineURL) {        rv = StartLoad(argv[1]);    } else {        rv = StartLoad("http://badhostnamexyz/test.txt");    }    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 = 0;    }#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 */    }    NS_ShutdownXPCOM(nsnull);    if (gError) {        fprintf(stderr, "\n\n-------ERROR-------\n\n");    }    return rv;}