зеркало из https://github.com/mozilla/pjs.git
ugh. I did not mean to commit these changes. Backing out
This commit is contained in:
Родитель
fc605d13e1
Коммит
99c6f8e84d
|
@ -2879,16 +2879,11 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when, nsIFile *inDirSpec)
|
|||
|
||||
if (!iim)
|
||||
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
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
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
|
||||
nsIServiceManager *mgr = NS_STATIC_CAST(nsIServiceManager*, this);
|
||||
|
|
|
@ -2485,23 +2485,24 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
|||
rv = GetPath(&ePath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
SwapSlashColon(ePath);
|
||||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
escPath.Insert("file:///", 0);
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
SwapSlashColon(ePath);
|
||||
|
||||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
escPath.Insert("file:///", 0);
|
||||
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
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);
|
||||
return rv;
|
||||
|
|
|
@ -1425,23 +1425,22 @@ NS_IMETHODIMP nsLocalFile::GetURL(char * *aURL)
|
|||
rv = GetPath(&ePath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
SwapSlashColon(ePath);
|
||||
// Escape the path with the directory mask
|
||||
rv = nsStdEscape(ePath, esc_Directory+esc_Forced, escPath);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
escPath.Insert("file:///", 0);
|
||||
if (escPath[escPath.Length() - 1] != '/') {
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir) {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
|
||||
escPath.Insert("file://", 0);
|
||||
|
||||
PRBool dir;
|
||||
rv = IsDirectory(&dir);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Cannot tell if this is a directory");
|
||||
if (NS_SUCCEEDED(rv) && dir && escPath[escPath.Length() - 1] != '/') {
|
||||
// make sure we have a trailing slash
|
||||
escPath += "/";
|
||||
}
|
||||
*aURL = ToNewCString(escPath);
|
||||
rv = *aURL ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
}
|
||||
CRTFREEIF(ePath);
|
||||
return rv;
|
||||
|
|
|
@ -120,42 +120,8 @@ PR_STATIC_CALLBACK(PRBool) DeleteSystemDirKeys(nsHashKey *aKey, void *aData, voi
|
|||
|
||||
#define NS_SYSTEMDIR_HASH_NUM (10)
|
||||
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");
|
||||
if(gShell32DLLInst)
|
||||
{
|
||||
gGetSpecialPathProc = (GetSpecialPathProc) GetProcAddress(gShell32DLLInst,
|
||||
"SHGetSpecialFolderPath");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
NS_COM void StartupSpecialSystemDirectory(){}
|
||||
|
||||
NS_COM void ShutdownSpecialSystemDirectory()
|
||||
{
|
||||
|
@ -164,14 +130,6 @@ NS_COM void ShutdownSpecialSystemDirectory()
|
|||
systemDirectoriesLocations->Reset(DeleteSystemDirKeys);
|
||||
delete systemDirectoriesLocations;
|
||||
}
|
||||
#if defined (XP_WIN)
|
||||
if (gShell32DLLInst)
|
||||
{
|
||||
FreeLibrary(gShell32DLLInst);
|
||||
gShell32DLLInst = NULL;
|
||||
gGetSpecialPathProc = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (XP_WIN)
|
||||
|
@ -219,25 +177,6 @@ static char* MakeUpperCase(char* aPath)
|
|||
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;
|
||||
LPSTR pBuffer = NULL;
|
||||
LPITEMIDLIST pItemIDList = NULL;
|
||||
|
|
|
@ -71,9 +71,6 @@ void main(int argc, char* argv[])
|
|||
else {
|
||||
printf("Failed to create %s (%x)\n", cidStr, rv);
|
||||
}
|
||||
|
||||
nsComponentManager::FreeLibraries();
|
||||
|
||||
}
|
||||
|
||||
rv = NS_ShutdownXPCOM(servMgr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче