return PR_TRUE;
return NS_OK;
PRBool pref_InitInitialObjects()// Initialize default preference JavaScript buffers from// appropriate TEXT resources//----------------------------------------------------------------------------------------{  nsCOMPtr<nsIFile> aFile;  nsCOMPtr<nsIFile> defaultPrefDir;  nsresult          rv;  PRBool            hasMoreElements;          static const char* specialFiles[] = {#if defined(XP_MAC) || defined(XP_MACOSX)      "macprefs.js"#elif defined(XP_WIN)      "winpref.js"#elif defined(XP_UNIX)      "unix.js"#if defined(VMS)      , "openvms.js"#elif defined(_AIX)      , "aix.js"#endif#if defined(MOZ_WIDGET_PHOTON)	  , "photon.js"#endif		 #elif defined(XP_OS2)      "os2pref.js"#elif defined(XP_BEOS)      "beos.js"#endif  };  rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir));  if (NS_FAILED(rv))    return PR_FALSE;  nsIFile **defaultPrefFiles = (nsIFile **)nsMemory::Alloc(INITIAL_MAX_DEFAULT_PREF_FILES * sizeof(nsIFile *));  int maxDefaultPrefFiles = INITIAL_MAX_DEFAULT_PREF_FILES;  int numFiles = 0;  // Parse all the random files that happen to be in the components directory.  nsCOMPtr<nsISimpleEnumerator> dirIterator;  rv = defaultPrefDir->GetDirectoryEntries(getter_AddRefs(dirIterator));  if (!dirIterator) {    NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a directory iterator.");    return PR_FALSE;  }  dirIterator->HasMoreElements(&hasMoreElements);  if (!hasMoreElements) {    NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Prefs directory is empty.");    return PR_FALSE;  }  while (hasMoreElements) {    PRBool shouldParse = PR_TRUE;    nsCAutoString leafName;    dirIterator->GetNext(getter_AddRefs(aFile));    dirIterator->HasMoreElements(&hasMoreElements);    rv = aFile->GetNativeLeafName(leafName);    if (NS_SUCCEEDED(rv)) {      // Skip non-js files      if (!StringEndsWith(leafName, NS_LITERAL_CSTRING(".js")))        shouldParse = PR_FALSE;      // Skip files in the special list.      if (shouldParse) {        for (int j = 0; j < (int) (sizeof(specialFiles) / sizeof(char *)); j++)          if (!strcmp(leafName.get(), specialFiles[j]))            shouldParse = PR_FALSE;      }      if (shouldParse) {        rv = aFile->Clone(&(defaultPrefFiles[numFiles]));        if NS_SUCCEEDED(rv) {          ++numFiles;          if (numFiles == maxDefaultPrefFiles) {            // double the size of the array            maxDefaultPrefFiles *= 2;            defaultPrefFiles = (nsIFile **)nsMemory::Realloc(defaultPrefFiles, maxDefaultPrefFiles * sizeof(nsIFile *));          }        }      }    }  };  NS_QuickSort((void *)defaultPrefFiles, numFiles, sizeof(nsIFile *), inplaceSortCallback, nsnull);  int k;  for (k = 0; k < numFiles; k++) {    rv = openPrefFile(defaultPrefFiles[k], PR_FALSE, PR_FALSE, PR_FALSE);    NS_ASSERTION(NS_SUCCEEDED(rv), "Config file not parsed successfully");    NS_RELEASE(defaultPrefFiles[k]);  }  nsMemory::Free(defaultPrefFiles);  // Finally, parse any other special files (platform-specific ones).  for (k = 0; k < (int) (sizeof(specialFiles) / sizeof(char *)); k++) {    // we must get the directory every time so we can append the child    // because SetLeafName will not work here.    rv = defaultPrefDir->Clone(getter_AddRefs(aFile));    if (NS_SUCCEEDED(rv)) {      rv = aFile->AppendNative(nsDependentCString(specialFiles[k]));      if (NS_SUCCEEDED(rv)) {        rv = openPrefFile(aFile, PR_FALSE, PR_FALSE, PR_FALSE);        NS_ASSERTION(NS_SUCCEEDED(rv), "<platform>.js was not parsed successfully");      }    }  }  return PR_TRUE;}