When it comes to gnome-vfs support overwriting mDefaultAppDescription is wrong in any case.
From looking at the code I'm not sure when it would make sense.
I changed that to use nsGNOMERegistry since it's a bit shorter to implement.
I'm not sure why it was using the gnome-vfs component directly while the module already depends on nsGNOMERegistry but if there was a valid reason that could be changed.
> if (vfs) {
> nsCOMPtr<nsIGnomeVFSMimeApp> app;
> if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
> return app->Launch(nativePath);
>+
>+ // If we haven't got an app we try to get a valid one by searching for the
>+ // extension mapped type
>+ nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
>+ if (mimeInfo) {
>+ nsCAutoString type;
>+ mimeInfo->GetType(type);
>+ if (NS_SUCCEEDED(vfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
>+ return app->Launch(nativePath);
>+ }
While commenting that part I actually think there should be a return value check for GetType()?
> // Copy the attributes of retval onto miByExt, to return it
> retval->CopyBasicDataTo(miByExt);
>+ // But set the extensions primary since CopyBasicDataTo overwrites the
>+ // list
>+ if (!aFileExt.IsEmpty())
>+ retval->SetPrimaryExtension(aFileExt);
This was actually a side effect by trying to fix the issue.
I _think_ that should be done but I might be wrong.
(From update of attachment 334886) exthandler/ nsMIMEInfoImpl. cpp 19 Oct 2007 04:15:43 -0000 1.69 exthandler/ nsMIMEInfoImpl. cpp 20 Aug 2008 15:45:32 -0000 :LaunchWithURI( nsIURI* aU :CopyBasicDataT o(nsMIMEInfoBas e* aOther) >mDefaultAppDes cription = mDefaultAppDesc ription; >mDefaultAppDes cription = mDefaultAppDesc ription;
>--- uriloader/
>+++ uriloader/
>@@ -408,13 +408,13 @@ nsMIMEInfoBase:
> }
>
> void
> nsMIMEInfoBase:
> {
> aOther->mType = mType;
>- aOther-
>+ //aOther-
When it comes to gnome-vfs support overwriting mDefaultAppDesc ription is wrong in any case.
From looking at the code I'm not sure when it would make sense.
> NS_IMETHODIMP :GetHasDefaultH andler( PRBool *_retval) nsIGnomeVFSServ ice> vfs = do_GetService( NS_GNOMEVFSSERV ICE_CONTRACTID) ; nsIGnomeVFSMime App> app; vfs->GetAppForM imeType( mType, getter_ AddRefs( app))) && app) nsMIMEInfoBase> mimeInfo = nsGNOMERegistry ::GetFromType( mType); GetPrimaryExten sion(ext) )) ::GetFromExtens ion(ext) ;
> nsMIMEInfoUnix:
> {
> *_retval = PR_FALSE;
>- nsCOMPtr<
>- if (vfs) {
>- nsCOMPtr<
>- if (NS_SUCCEEDED(
>- *_retval = PR_TRUE;
>+ nsRefPtr<
>+ if (!mimeInfo) {
>+ nsCAutoString ext;
>+ if (NS_SUCCEEDED(
>+ mimeInfo = nsGNOMERegistry
I changed that to use nsGNOMERegistry since it's a bit shorter to implement.
I'm not sure why it was using the gnome-vfs component directly while the module already depends on nsGNOMERegistry but if there was a valid reason that could be changed.
> if (vfs) { nsIGnomeVFSMime App> app; vfs->GetAppForM imeType( mType, getter_ AddRefs( app))) && app) nativePath) ; nsMIMEInfoBase> mimeInfo = nsGNOMERegistry ::GetFromExtens ion(nativePath) ; >GetType( type); vfs->GetAppForM imeType( type, getter_ AddRefs( app))) && app) nativePath) ;
> nsCOMPtr<
> if (NS_SUCCEEDED(
> return app->Launch(
>+
>+ // If we haven't got an app we try to get a valid one by searching for the
>+ // extension mapped type
>+ nsRefPtr<
>+ if (mimeInfo) {
>+ nsCAutoString type;
>+ mimeInfo-
>+ if (NS_SUCCEEDED(
>+ return app->Launch(
>+ }
While commenting that part I actually think there should be a return value check for GetType()?
> // Copy the attributes of retval onto miByExt, to return it >CopyBasicDataT o(miByExt) ; IsEmpty( )) >SetPrimaryExte nsion(aFileExt) ;
> retval-
>+ // But set the extensions primary since CopyBasicDataTo overwrites the
>+ // list
>+ if (!aFileExt.
>+ retval-
This was actually a side effect by trying to fix the issue.
I _think_ that should be done but I might be wrong.