if (yieldProc != NULL) (*yieldProc)(url->GetSpec());
while (!g_bReadyForNextUrl) { if (yieldProc != NULL) (*yieldProc)(url->GetSpec()); }
extern "C" NS_EXPORT int DebugRobot(   nsVoidArray * workList,    nsIWebWidget * ww,    int iMaxLoads,    char * verify_dir,   void (*yieldProc )(const char *)   ){  if (nsnull==workList)     return -1;  g_iMaxProcess = iMaxLoads;  g_iProcessed = 0;  g_bHitTop = PR_FALSE;  g_duplicateList = new nsVoidArray();  RobotSinkObserver* myObserver = new RobotSinkObserver();  //SetVerificationDirectory(verify_dir);  NS_ADDREF(myObserver);  g_workList = workList;  for (;;) {    PRInt32 n = g_workList->Count();    if (0 == n) {      break;    }    nsString* urlName = (nsString*) g_workList->ElementAt(n - 1);    g_workList->RemoveElementAt(n - 1);    // Create url    nsIURL* url;    nsresult rv = NS_NewURL(&url, *urlName);    if (NS_OK != rv) {      printf("invalid URL: '");      fputs(*urlName, stdout);      printf("'\n");      return -1;    }    delete urlName;    nsIParser* parser;    rv = NS_NewHTMLParser(&parser);    if (NS_OK != rv) {      printf("can't make parser\n");      return -1;    }    nsIRobotSink* sink;    rv = NS_NewRobotSink(&sink);    if (NS_OK != rv) {      printf("can't make parser\n");      return -1;    }    sink->Init(url);    sink->AddObserver(myObserver);    parser->SetContentSink(sink);    parser->Parse(url);    if (yieldProc != NULL)       (*yieldProc)(url->GetSpec());    if (ww)       ww->LoadURL(url->GetSpec());    NS_RELEASE(sink);    NS_RELEASE(parser);    NS_RELEASE(url);  }  NS_RELEASE(myObserver);  return 0;}