Fix helper apps not starting when the filename in the url is empty.
Also turn off caching of mime infos since we have no way to invalidate this cache yet. Bug 121644, r=law, sr=mscott git-svn-id: svn://10.0.0.236/trunk@113742 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -280,7 +280,8 @@ nsHelperAppDialog.prototype = {
|
||||
try
|
||||
{
|
||||
var fileURL = url.QueryInterface( Components.interfaces.nsIFileURL);
|
||||
if (fileURL)
|
||||
// All URLs will QI to nsIFileURL. Need to check the scheme to determine type
|
||||
if (fileURL.schemeIs("file"))
|
||||
{
|
||||
var fileObject = fileURL.file;
|
||||
if (fileObject)
|
||||
|
||||
@@ -175,8 +175,9 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromExtension(const char * aFileExt, nsIM
|
||||
rv = icService->GetMIMEInfoFromExtension(aFileExt, aMIMEInfo);
|
||||
// if we got an entry, don't waste time hitting IC for this information next time, store it in our
|
||||
// hash table....
|
||||
if (NS_SUCCEEDED(rv) && *aMIMEInfo)
|
||||
AddMimeInfoToCache(*aMIMEInfo);
|
||||
// XXX Once cache can be invalidated, add the mime info to it. See bug 121644
|
||||
// if (NS_SUCCEEDED(rv) && *aMIMEInfo)
|
||||
// AddMimeInfoToCache(*aMIMEInfo);
|
||||
}
|
||||
|
||||
if (!*aMIMEInfo) rv = NS_ERROR_FAILURE;
|
||||
@@ -200,8 +201,9 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char * aMIMEType, nsIM
|
||||
rv = icService->FillInMIMEInfo(aMIMEType, nsnull, aMIMEInfo);
|
||||
// if we got an entry, don't waste time hitting IC for this information next time, store it in our
|
||||
// hash table....
|
||||
if (NS_SUCCEEDED(rv) && *aMIMEInfo)
|
||||
AddMimeInfoToCache(*aMIMEInfo);
|
||||
// XXX Once cache can be invalidated, add the mime info to it. See bug 121644
|
||||
// if (NS_SUCCEEDED(rv) && *aMIMEInfo)
|
||||
// AddMimeInfoToCache(*aMIMEInfo);
|
||||
}
|
||||
|
||||
if (!*aMIMEInfo) rv = NS_ERROR_FAILURE;
|
||||
|
||||
@@ -288,7 +288,9 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
|
||||
}
|
||||
|
||||
PRBool matches = PR_FALSE;
|
||||
mimeInfo->ExtensionExists(fileExtension.get(), &matches);
|
||||
if (!fileExtension.IsEmpty()) {
|
||||
mimeInfo->ExtensionExists(fileExtension.get(), &matches);
|
||||
}
|
||||
if (matches) {
|
||||
mimeInfo->SetPrimaryExtension(fileExtension.get());
|
||||
} else {
|
||||
@@ -1331,6 +1333,15 @@ NS_IMETHODIMP nsExternalAppHandler::LaunchWithApplication(nsIFile * aApplication
|
||||
#else
|
||||
NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(fileToUse));
|
||||
#endif
|
||||
|
||||
if (mSuggestedFileName.IsEmpty())
|
||||
{
|
||||
// Keep using the leafname of the temp file, since we're just starting a helper
|
||||
PRUnichar* filename;
|
||||
mTempFile->GetUnicodeLeafName(&filename);
|
||||
mSuggestedFileName.Adopt(filename);
|
||||
}
|
||||
|
||||
fileToUse->AppendUnicode(mSuggestedFileName.get());
|
||||
// We'll make sure this results in a unique name later
|
||||
|
||||
|
||||
@@ -286,7 +286,8 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromExtension(const char *aFileExt, nsIMI
|
||||
// table so we don't hit the registry the next time we look up this content type.
|
||||
*_retval = mimeInfo;
|
||||
NS_ADDREF(*_retval);
|
||||
AddMimeInfoToCache(mimeInfo);
|
||||
// XXX Once cache can be invalidated, add the mime info to it. See bug 121644
|
||||
// AddMimeInfoToCache(mimeInfo);
|
||||
} /* endif */
|
||||
|
||||
// we failed to find a mime type.
|
||||
|
||||
@@ -1205,7 +1205,8 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromExtension(const char *aFileExt,
|
||||
*_retval = mimeInfo;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
AddMimeInfoToCache(*_retval);
|
||||
// XXX Once cache can be invalidated, add the mime info to it. See bug 121644
|
||||
// AddMimeInfoToCache(*_retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1299,6 +1300,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char *aMIMEType,
|
||||
*_retval = mimeInfo;
|
||||
NS_ADDREF(*_retval);
|
||||
|
||||
AddMimeInfoToCache(*_retval);
|
||||
// XXX Once cache can be invalidated, add the mime info to it. See bug 121644
|
||||
// AddMimeInfoToCache(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user