Skip to content

Commit 80a163d

Browse files
author
dougt%netscape.com
committed
ugh. I did not mean to commit these changes. Backing out
1 parent 32aa640 commit 80a163d

File tree

5 files changed

+30
-99
lines changed

5 files changed

+30
-99
lines changed

xpcom/components/nsComponentManager.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,16 +2879,11 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when, nsIFile *inDirSpec)
28792879

28802880
if (!iim)
28812881
return NS_ERROR_UNEXPECTED;
2882-
2883-
// Startup any category observers that may want to listen to autoreg
2884-
NS_CreateServicesFromCategory("xpcom-observers",
2885-
nsnull,
2886-
NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID);
2887-
2882+
28882883
// Notify observers of xpcom autoregistration start
28892884
nsCOMPtr<nsIObserverService> observerService =
28902885
do_GetService("@mozilla.org/observer-service;1", &rv);
2891-
if (NS_SUCCEEDED(rv))
2886+
if (NS_FAILED(rv))
28922887
{
28932888
// NO COMPtr as we dont release the service manager
28942889
nsIServiceManager *mgr = NS_STATIC_CAST(nsIServiceManager*, this);

xpcom/io/nsLocalFileMac.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,23 +2485,24 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
24852485
rv = GetPath(&ePath);
24862486
if (NS_SUCCEEDED(rv)) {
24872487

2488-
SwapSlashColon(ePath);
2489-
// Escape the path with the directory mask
2490-
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
2491-
if (NS_SUCCEEDED(rv)) {
2492-
escPath.Insert("file:///", 0);
2493-
if (escPath[escPath.Length() - 1] != '/') {
2494-
PRBool dir;
2495-
rv = IsDirectory(&dir);
2496-
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
2497-
if (NS_SUCCEEDED(rv) && dir) {
2498-
// make sure we have a trailing slash
2499-
escPath += "/";
2500-
}
2488+
SwapSlashColon(ePath);
2489+
2490+
// Escape the path with the directory mask
2491+
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
2492+
if (NS_SUCCEEDED(rv)) {
2493+
2494+
escPath.Insert("file:///", 0);
2495+
2496+
PRBool dir;
2497+
rv = IsDirectory(&dir);
2498+
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
2499+
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
2500+
// make sure we have a trailing slash
2501+
escPath += "/";
2502+
}
2503+
*aURL = nsCRT::strdup((const char *)escPath);
2504+
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
25012505
}
2502-
*aURL = nsCRT::strdup((const char *)escPath);
2503-
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
2504-
}
25052506
}
25062507
CRTFREEIF(ePath);
25072508
return rv;

xpcom/io/nsLocalFileUnix.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,23 +1425,22 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
14251425
rv = GetPath(&ePath);
14261426
if (NS_SUCCEEDED(rv)) {
14271427

1428-
SwapSlashColon(ePath);
14291428
// Escape the path with the directory mask
14301429
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
14311430
if (NS_SUCCEEDED(rv)) {
1432-
escPath.Insert("file:///", 0);
1433-
if (escPath[escPath.Length() - 1] != '/') {
1434-
PRBool dir;
1435-
rv = IsDirectory(&dir);
1436-
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
1437-
if (NS_SUCCEEDED(rv) && dir) {
1438-
// make sure we have a trailing slash
1439-
escPath += "/";
1440-
}
1431+
1432+
escPath.Insert("file://", 0);
1433+
1434+
PRBool dir;
1435+
rv = IsDirectory(&dir);
1436+
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
1437+
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
1438+
// make sure we have a trailing slash
1439+
escPath += "/";
14411440
}
14421441
*aURL = ToNewCString(escPath);
14431442
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
1444-
}
1443+
}
14451444
}
14461445
CRTFREEIF(ePath);
14471446
return rv;

xpcom/io/nsSpecialSystemDirectory.cpp

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -120,42 +120,8 @@ PR_STATIC_CALLBACK(PRBool) DeleteSystemDirKeys(nsHashKey *aKey, void *aData, voi
120120

121121
#define NS_SYSTEMDIR_HASH_NUM (10)
122122
static nsHashtable *systemDirectoriesLocations = NULL;
123-
#if defined (XP_WIN)
124-
typedef BOOL (WINAPI * GetSpecialPathProc) (HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
125-
GetSpecialPathProc gGetSpecialPathProc = NULL;
126-
static HINSTANCE gShell32DLLInst = NULL;
127-
#endif
128-
NS_COM void StartupSpecialSystemDirectory()
129-
{
130-
#if defined (XP_WIN)
131-
/* On windows, the old method to get file locations is incredibly slow.
132-
As of this writting, 3 calls to GetWindowsFolder accounts for 3% of mozilla
133-
startup. Replacing these older calls with a single call to SHGetSpecialFolderPath
134-
effectively removes these calls from the performace radar. We need to
135-
support the older way of file location lookup on systems that do not have
136-
IE4.
137-
*/
138-
gShell32DLLInst = LoadLibrary("shfolder.dll");
139-
if(gShell32DLLInst)
140-
{
141-
gGetSpecialPathProc = (GetSpecialPathProc) GetProcAddress(gShell32DLLInst,
142-
"SHGetSpecialFolderPath");
143-
}
144-
145-
if (!gGetSpecialPathProc)
146-
{
147-
if (gShell32DLLInst)
148-
FreeLibrary(gShell32DLLInst);
149123

150-
gShell32DLLInst = LoadLibrary("Shell32.dll");
151-
if(gShell32DLLInst)
152-
{
153-
gGetSpecialPathProc = (GetSpecialPathProc) GetProcAddress(gShell32DLLInst,
154-
"SHGetSpecialFolderPath");
155-
}
156-
}
157-
#endif
158-
}
124+
NS_COM void StartupSpecialSystemDirectory(){}
159125

160126
NS_COM void ShutdownSpecialSystemDirectory()
161127
{
@@ -164,14 +130,6 @@ NS_COM void ShutdownSpecialSystemDirectory()
164130
systemDirectoriesLocations->Reset(DeleteSystemDirKeys);
165131
delete systemDirectoriesLocations;
166132
}
167-
#if defined (XP_WIN)
168-
if (gShell32DLLInst)
169-
{
170-
FreeLibrary(gShell32DLLInst);
171-
gShell32DLLInst = NULL;
172-
gGetSpecialPathProc = NULL;
173-
}
174-
#endif
175133
}
176134

177135
#if defined (XP_WIN)
@@ -219,25 +177,6 @@ static char* MakeUpperCase(char* aPath)
219177
static void GetWindowsFolder(int folder, nsFileSpec& outDirectory)
220178
//----------------------------------------------------------------------------------------
221179
{
222-
223-
if (gGetSpecialPathProc) {
224-
TCHAR path[MAX_PATH];
225-
HRESULT result = gGetSpecialPathProc(NULL, path, folder, true);
226-
227-
if (!SUCCEEDED(result))
228-
return;
229-
230-
// Append the trailing slash
231-
int len = PL_strlen(path);
232-
if (len>1 && path[len-1] != '\\')
233-
{
234-
path[len] = '\\';
235-
path[len + 1] = '\0';
236-
}
237-
outDirectory = path;
238-
return;
239-
}
240-
241180
LPMALLOC pMalloc = NULL;
242181
LPSTR pBuffer = NULL;
243182
LPITEMIDLIST pItemIDList = NULL;

xpcom/tests/TestShutdown.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ void main(int argc, char* argv[])
7171
else {
7272
printf("Failed to create %s (%x)\n", cidStr, rv);
7373
}
74-
75-
nsComponentManager::FreeLibraries();
76-
7774
}
7875

7976
rv = NS_ShutdownXPCOM(servMgr);

0 commit comments

Comments
 (0)