HelperApp launch is broken with GIO

RESOLVED FIXED in mozilla2.0


8 years ago
2 years ago


(Reporter: wolfiR, Unassigned)



Firefox Tracking Flags

(Not tracked)



(2 attachments)



8 years ago
If GIO (instead of GnomeVFS) is used for HelperApp handling the Launch() method fails to do the right thing.
this method is using g_app_info_launch_uris() which expects a list of URIs (not files).
simply calls the method with a string containing the native local path.

The matching GnomeVFS method converts the path to a uri apparently:

I haven't found a fitting gio function to do a similar thing.
I have a candidate patch but it's currently changing the caller instead of the callee. I'm not sure what's the correct way to fix it.
The interface description suggests it should be called via uri and not file path but then it has been wrong for years because the callee fixed it silently.

Comment 1

8 years ago
Created attachment 513194 [details] [diff] [review]
possible patch

This one fixes the caller as described and it isn't very intrusive leaving the old non-gio code alone. 
As I said I'm unsure on which side to fix it in the end.

Comment 2

8 years ago
Comment on attachment 513194 [details] [diff] [review]
possible patch

Karl, asking for review but as written I'm not sure which side to fix.
Attachment #513194 - Flags: review?(karlt)
Comment on attachment 513194 [details] [diff] [review]
possible patch

This makes sense to me.

>+    nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID);
>+    nsCOMPtr<nsIURI> uri;
>+    ioservice->NewFileURI(aFile, getter_AddRefs(uri));

Should null check ioservice, I think.

>+    uri->GetSpec(uriSpec);

I saw another NewFileURI use where uri was not null-checked, so I don't know whether a null check on uri is necessary or not.
Attachment #513194 - Flags: review?(karlt) → review+

Comment 4

8 years ago
Created attachment 515658 [details] [diff] [review]
patch #2

same with two NS_ENSURE_SUCCESS checks

Comment 5

8 years ago
Comment on attachment 513194 [details] [diff] [review]
possible patch

That one is basically NPOTB (unless --enable-gio is used) and the original code just does not work. Not sure if I need approval in that case?
Attachment #513194 - Flags: approval2.0?
Comment on attachment 513194 [details] [diff] [review]
possible patch

Attachment #513194 - Flags: approval2.0? → approval2.0+

Comment 7

8 years ago
Last Resolved: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0


2 years ago
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.