Comment 13 for bug 239952

Revision history for this message
TJ (tj) wrote :

The explanation for the apparent forgetfulness of xulrunner is that there are two separate phases to the download process:

1. Populate the Helper Chooser Dialog list with mime-type helper applications
2. Launch with default mime-type helper

The solution would be to add functionality to nsMIMEInfoUnix::LaunchDefaultWithFile() that does the same thing as step 1 follows in determining the default helper.

However, Aexander has pointed me to a patch that may rework this process so the next step is to see if the patch has any positive effect on this default-handling in the absense of a sensible Content-Type from the web-server.

Here's the recent debug log showing the two phases.

=== log ===
*** POPULATE HELPER CHOOSER DIALOG ****

nsOSHelperAppService::GetMIMEInfoFromOS("unknown/unknown", "gz")

nsGNOMERegistry::GetFromType("unknown/unknown")
calling vfs->GetAppForMimeType()

nsGnomeVFSService::GetAppForMimeType("unknown/unknown", null)
calling gnome_vfs_mime_get_default_application()
Didn't get GnomeVFSMimeApplication

failed

!retval || !hasDefault

nsOSHelperAppService::GetFromExtension("gz")
calling LookUpTypeAndDescription()
LookUp failed
calling nsGNOMERegistry::GetFromExtension()

nsGnomeVFSService::GetMimeTypeFromExtension("gz", aMimeType)
calling gnome_vfs_mime_type_from_name()
aMimeType=application/x-gzip

nsGNOMERegistry::GetFromType("application/x-gzip")
calling vfs->GetAppForMimeType()

nsGnomeVFSService::GetAppForMimeType("application/x-gzip", null)
calling gnome_vfs_mime_get_default_application()
Successfully got GnomeVFSMimeApplication (id=file-roller.desktop, name=Archive Manager)
converting app to mozApp
transfering mozApp to aApp (0xf6abe0)

success

*** FILE DOWNLOAD COMPLETED ****

nsMIMEInfoUnix::GetHasDefaultHandler()
Using vfs
nsGnomeVFSService::GetAppForMimeType("unknown/unknown", null)
calling gnome_vfs_mime_get_default_application()
Didn't get GnomeVFSMimeApplication
fallback to nsMIMEInfoImpl::GetHasDefaultHandler()

**** ATTEMPT TO LAUNCH HELPER ***

nsMIMEInfoBase::LaunchWithFile()
mPreferredAction=4
mPreferredAction==useSystemDefault
calling LaunchDefaultWithFile()

nsMIMEInfoUnix::LaunchDefaultWithFile()
nativePath=/tmp/test4 with space.txt-4.gz
Using vfs

nsGnomeVFSService::GetAppForMimeType("unknown/unknown", null)
calling gnome_vfs_mime_get_default_application()
Didn't get GnomeVFSMimeApplication

vfs->GetAppForMimeType()=1
mDefaultApplication=0
!mDefaultApplication NS_ERROR_FILE_NOT_FOUND