ugh. I did not mean to commit these changes. Backing out

This commit is contained in:
dougt@netscape.com
2001-10-30 22:19:32 +00:00
parent 5b8e7b5c11
commit d1f771603f
5 changed files with 30 additions and 99 deletions

View File

@@ -2879,16 +2879,11 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when, nsIFile *inDirSpec)
if (!iim) if (!iim)
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
// Startup any category observers that may want to listen to autoreg
NS_CreateServicesFromCategory("xpcom-observers",
nsnull,
NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID);
// Notify observers of xpcom autoregistration start // Notify observers of xpcom autoregistration start
nsCOMPtr<nsIObserverService> observerService = nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv); do_GetService("@mozilla.org/observer-service;1", &rv);
if (NS_SUCCEEDED(rv)) if (NS_FAILED(rv))
{ {
// NO COMPtr as we dont release the service manager // NO COMPtr as we dont release the service manager
nsIServiceManager *mgr = NS_STATIC_CAST(nsIServiceManager*, this); nsIServiceManager *mgr = NS_STATIC_CAST(nsIServiceManager*, this);

View File

@@ -2485,23 +2485,24 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
rv = GetPath(&ePath); rv = GetPath(&ePath);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
SwapSlashColon(ePath); SwapSlashColon(ePath);
// Escape the path with the directory mask
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath); // Escape the path with the directory mask
if (NS_SUCCEEDED(rv)) { rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
escPath.Insert("file:///", 0); if (NS_SUCCEEDED(rv)) {
if (escPath[escPath.Length() - 1] != '/') {
PRBool dir; escPath.Insert("file:///", 0);
rv = IsDirectory(&dir);
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory"); PRBool dir;
if (NS_SUCCEEDED(rv) && dir) { rv = IsDirectory(&dir);
// make sure we have a trailing slash NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
escPath += "/"; if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
} // make sure we have a trailing slash
escPath += "/";
}
*aURL = nsCRT::strdup((const char *)escPath);
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
} }
*aURL = nsCRT::strdup((const char *)escPath);
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
} }
CRTFREEIF(ePath); CRTFREEIF(ePath);
return rv; return rv;

View File

@@ -1425,23 +1425,22 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
rv = GetPath(&ePath); rv = GetPath(&ePath);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
SwapSlashColon(ePath);
// Escape the path with the directory mask // Escape the path with the directory mask
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath); rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
escPath.Insert("file:///", 0);
if (escPath[escPath.Length() - 1] != '/') { escPath.Insert("file://", 0);
PRBool dir;
rv = IsDirectory(&dir); PRBool dir;
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory"); rv = IsDirectory(&dir);
if (NS_SUCCEEDED(rv) && dir) { NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
// make sure we have a trailing slash if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
escPath += "/"; // make sure we have a trailing slash
} escPath += "/";
} }
*aURL = ToNewCString(escPath); *aURL = ToNewCString(escPath);
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY; rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
} }
} }
CRTFREEIF(ePath); CRTFREEIF(ePath);
return rv; return rv;

View File

@@ -120,42 +120,8 @@ PR_STATIC_CALLBACK(PRBool) DeleteSystemDirKeys(nsHashKey *aKey, void *aData, voi
#define NS_SYSTEMDIR_HASH_NUM (10) #define NS_SYSTEMDIR_HASH_NUM (10)
static nsHashtable *systemDirectoriesLocations = NULL; static nsHashtable *systemDirectoriesLocations = NULL;
#if defined (XP_WIN)
typedef BOOL (WINAPI * GetSpecialPathProc) (HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
GetSpecialPathProc gGetSpecialPathProc = NULL;
static HINSTANCE gShell32DLLInst = NULL;
#endif
NS_COM void StartupSpecialSystemDirectory()
{
#if defined (XP_WIN)
/* On windows, the old method to get file locations is incredibly slow.
As of this writting, 3 calls to GetWindowsFolder accounts for 3% of mozilla
startup. Replacing these older calls with a single call to SHGetSpecialFolderPath
effectively removes these calls from the performace radar. We need to
support the older way of file location lookup on systems that do not have
IE4.
*/
gShell32DLLInst = LoadLibrary("shfolder.dll");
if(gShell32DLLInst)
{
gGetSpecialPathProc = (GetSpecialPathProc) GetProcAddress(gShell32DLLInst,
"SHGetSpecialFolderPath");
}
if (!gGetSpecialPathProc)
{
if (gShell32DLLInst)
FreeLibrary(gShell32DLLInst);
gShell32DLLInst = LoadLibrary("Shell32.dll"); NS_COM void StartupSpecialSystemDirectory(){}
if(gShell32DLLInst)
{
gGetSpecialPathProc = (GetSpecialPathProc) GetProcAddress(gShell32DLLInst,
"SHGetSpecialFolderPath");
}
}
#endif
}
NS_COM void ShutdownSpecialSystemDirectory() NS_COM void ShutdownSpecialSystemDirectory()
{ {
@@ -164,14 +130,6 @@ NS_COM void ShutdownSpecialSystemDirectory()
systemDirectoriesLocations->Reset(DeleteSystemDirKeys); systemDirectoriesLocations->Reset(DeleteSystemDirKeys);
delete systemDirectoriesLocations; delete systemDirectoriesLocations;
} }
#if defined (XP_WIN)
if (gShell32DLLInst)
{
FreeLibrary(gShell32DLLInst);
gShell32DLLInst = NULL;
gGetSpecialPathProc = NULL;
}
#endif
} }
#if defined (XP_WIN) #if defined (XP_WIN)
@@ -219,25 +177,6 @@ static char* MakeUpperCase(char* aPath)
static void GetWindowsFolder(int folder, nsFileSpec& outDirectory) static void GetWindowsFolder(int folder, nsFileSpec& outDirectory)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
{ {
if (gGetSpecialPathProc) {
TCHAR path[MAX_PATH];
HRESULT result = gGetSpecialPathProc(NULL, path, folder, true);
if (!SUCCEEDED(result))
return;
// Append the trailing slash
int len = PL_strlen(path);
if (len>1 && path[len-1] != '\\')
{
path[len] = '\\';
path[len + 1] = '\0';
}
outDirectory = path;
return;
}
LPMALLOC pMalloc = NULL; LPMALLOC pMalloc = NULL;
LPSTR pBuffer = NULL; LPSTR pBuffer = NULL;
LPITEMIDLIST pItemIDList = NULL; LPITEMIDLIST pItemIDList = NULL;

View File

@@ -71,9 +71,6 @@ void main(int argc, char* argv[])
else { else {
printf("Failed to create %s (%x)\n", cidStr, rv); printf("Failed to create %s (%x)\n", cidStr, rv);
} }
nsComponentManager::FreeLibraries();
} }
rv = NS_ShutdownXPCOM(servMgr); rv = NS_ShutdownXPCOM(servMgr);