зеркало из https://github.com/mozilla/gecko-dev.git
fix bad merging of code for 183848 when moving from camino 1.0 branch to trunk
(r=biesi, sr=sfraser)
This commit is contained in:
Родитель
85dbaacab3
Коммит
719ba07a9f
|
@ -65,41 +65,39 @@ NS_IMETHODIMP nsOSHelperAppService::LaunchAppWithTempFile(nsIMIMEInfo * aMIMEInf
|
|||
else
|
||||
aMIMEInfo->GetDefaultApplicationHandler(getter_AddRefs(application));
|
||||
|
||||
if (!application)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
nsCOMPtr<nsILocalFileMac> app = do_QueryInterface(application, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsILocalFile> docToLoad = do_QueryInterface(aTempFile, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = app->LaunchWithDoc(docToLoad, PR_FALSE);
|
||||
}
|
||||
#ifdef XP_MACOSX
|
||||
else
|
||||
{ // We didn't get an application to handle the file from aMIMEInfo, ask LaunchServices directly
|
||||
nsCOMPtr <nsILocalFileMac> tempFile = do_QueryInterface(aTempFile, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
FSRef tempFileRef;
|
||||
tempFile->GetFSRef(&tempFileRef);
|
||||
|
||||
FSRef appFSRef;
|
||||
if (::LSGetApplicationForItem(&tempFileRef, kLSRolesAll, &appFSRef, nsnull) == noErr)
|
||||
{
|
||||
nsCOMPtr<nsILocalFileMac> app(do_CreateInstance("@mozilla.org/file/local;1"));
|
||||
if (!app) return NS_ERROR_FAILURE;
|
||||
app->InitWithFSRef(&appFSRef);
|
||||
|
||||
nsCOMPtr <nsILocalFile> docToLoad = do_QueryInterface(aTempFile, &rv);
|
||||
if (application) {
|
||||
nsCOMPtr<nsILocalFileMac> app = do_QueryInterface(application, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsCOMPtr<nsILocalFile> docToLoad = do_QueryInterface(aTempFile, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = app->LaunchWithDoc(docToLoad, PR_FALSE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
else
|
||||
{ // We didn't get an application to handle the file from aMIMEInfo, ask LaunchServices directly
|
||||
nsCOMPtr <nsILocalFileMac> tempFile = do_QueryInterface(aTempFile, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
FSRef tempFileRef;
|
||||
tempFile->GetFSRef(&tempFileRef);
|
||||
|
||||
FSRef appFSRef;
|
||||
if (::LSGetApplicationForItem(&tempFileRef, kLSRolesAll, &appFSRef, nsnull) == noErr)
|
||||
{
|
||||
nsCOMPtr<nsILocalFileMac> app(do_CreateInstance("@mozilla.org/file/local;1"));
|
||||
if (!app) return NS_ERROR_FAILURE;
|
||||
app->InitWithFSRef(&appFSRef);
|
||||
|
||||
nsCOMPtr <nsILocalFile> docToLoad = do_QueryInterface(aTempFile, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = app->LaunchWithDoc(docToLoad, PR_FALSE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче