if (fetchTables && !wallet_tablesFetched) { wallet_FetchFromNetCenter(); wallet_tablesFetched = PR_TRUE; }
wallet_Initialize(PRBool fetchTables, PRBool unlockDatabase=PR_TRUE) {  static PRBool wallet_tablesInitialized = PR_FALSE;  static PRBool wallet_tablesFetched = PR_FALSE;  static PRBool wallet_ValuesReadIn = PR_FALSE;  static PRBool namesInitialized = PR_FALSE;  /* initialize tables    * Note that we don't initialize the tables if this call was made from the wallet   * editor.  The tables are certainly not needed since all we are doing is displaying   * the contents of the user wallet.  Furthermore, there is a problem which causes the   * window to come up blank in that case.  Has something to do with the fact that we   * were being called from javascript in this case.  So to avoid the problem, the    * fetchTables parameter was added and it is set to PR_FALSE in the case of the   * wallet editor and PR_TRUE in all other cases   *   * Similar problem applies to changing password.  Don't need tables in that case and   * fetching them was causing a hang -- see bug 28148 and bug 28145.   */#ifdef DEBUG//wallet_ClearStopwatch();//wallet_ResumeStopwatch();#endif  if (fetchTables && !wallet_tablesFetched) {    wallet_FetchFromNetCenter();    wallet_tablesFetched = PR_TRUE;  }  if (!wallet_tablesInitialized) {#ifdef DEBUG//wallet_PauseStopwatch();//wallet_DumpStopwatch();#endif//    printf("******** start profile\n");//             ProfileStart();    wallet_Clear(&wallet_FieldToSchema_list); /* otherwise we will duplicate the list */    wallet_Clear(&wallet_URLFieldToSchema_list); /* otherwise we will duplicate the list */    wallet_Clear(&wallet_SchemaConcat_list); /* otherwise we will duplicate the list */#ifdef AutoCapture    wallet_Clear(&wallet_DistinguishedSchema_list); /* otherwise we will duplicate the list */    wallet_ReadFromFile(distinguishedSchemaFileName, wallet_DistinguishedSchema_list, PR_FALSE);#endif    wallet_ReadFromFile(fieldSchemaFileName, wallet_FieldToSchema_list, PR_FALSE);    wallet_ReadFromURLFieldToSchemaFile(URLFieldSchemaFileName, wallet_URLFieldToSchema_list);    wallet_ReadFromFile(schemaConcatFileName, wallet_SchemaConcat_list, PR_FALSE);//    ProfileStop();//   printf("****** end profile\n");    wallet_tablesInitialized = PR_TRUE;  }  if (!unlockDatabase) {    return;  }  if (!namesInitialized) {    SI_GetCharPref(pref_WalletSchemaValueFileName, &schemaValueFileName);    if (!schemaValueFileName) {      schemaValueFileName = Wallet_RandomName("w");      SI_SetCharPref(pref_WalletSchemaValueFileName, schemaValueFileName);    }    SI_InitSignonFileName();    namesInitialized = PR_TRUE;  }  if (!wallet_ValuesReadIn) {    wallet_Clear(&wallet_SchemaToValue_list); /* otherwise we will duplicate the list */    wallet_ReadFromFile(schemaValueFileName, wallet_SchemaToValue_list, PR_TRUE);    wallet_ValuesReadIn = PR_TRUE;  }#if DEBUG//    fprintf(stdout,"Field to Schema table \n");//    wallet_Dump(wallet_FieldToSchema_list);//    fprintf(stdout,"SchemaConcat table \n");//    wallet_Dump(wallet_SchemaConcat_list);//    fprintf(stdout,"URL Field to Schema table \n");//    char item1[100];//    wallet_MapElement * ptr;//    PRInt32 count = LIST_COUNT(wallet_URLFieldToSchema_list);//    for (PRInt32 i=0; i<count; i++) {//      ptr = NS_STATIC_CAST(wallet_MapElement*, wallet_URLFieldToSchema_list->ElementAt(i));//      ptr->item1.ToCString(item1, 100);//      fprintf(stdout, item1);//      fprintf(stdout,"\n");//      wallet_Dump(ptr->itemList);//    }//    fprintf(stdout,"Schema to Value table \n");//    wallet_Dump(wallet_SchemaToValue_list);#endif}