Closed Bug 264647 Opened 20 years ago Closed 20 years ago

Implement nsOSHelperAppService::GetApplicationDescription for OS/2

Categories

(Core Graveyard :: File Handling, defect)

x86
OS/2
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Biesinger, Assigned: mozilla)

References

Details

Attachments

(1 file, 1 obsolete file)

to be able to show an application description in the confirmation dialog for
external protocols, nsOSHelperAppService::GetApplicationDescription should be
implemented.

this bug is about the OS/2 implementation.
What kind of description did you think of? What do Windows or Linux give me if I
lauch a link like mailto: with a script runmymailprogram.cmd or if I run a ssh:
link with putty.exe?
The windows code seems to look something up in the registry, but I have no idea
what is in there...
the windows code, as well as the linux and gnome code, use the leaf name of the
application as description. (windows will be changed to use the application's
description from its resource, in bug 252189).

os/2 currently shows <Unknown>, I think; which is somewhat undesirable..
oops. actually, windows seems to use the full pathname to the application.
rather, whatever the application stored there... (full pathname seems common)
OK, thanks. Full pathname should be possible, don't know what a leaf name is,
anyway... Although it would be nice to show something more descriptive, I don't
think that's easy to get on OS/2. Well, some EXE files have some kind of
application description embedded, perhaps that can be used, although it does not
seem to be very standardized. I will try to use that.
given c:\foo\bar.exe, leaf name would be bar.exe (i.e. just the filename w/o
directory information)
Hmm, for OS/2 this would mean to go through all the stuff that we now do to
determine the handling app including the internet app(s) as set in the URL
object and/or ConfigApps, see bug 254320. Either we duplicate a lot of code to
create something like the GetHandlerAppFromPrefs that is used for this on Unix
(and we already have duplicate stuff in ExternalProtocolHandlerExists and
LoadUriInternal). Or we invent a new method/function that handles at least the
case where the handler is drawn from the INI file. As the platforms already have
wildly different methods in nsOSHelperAppService.cpp anyway, I guess the latter
approach is the one to go for...
OK, a first try to implement this. I moved the application from OS2.INI stuff
to a new helper method ::GetApplicationAndParametersFromINI and then used this
and stuff from ::LoadUriInternal for the new method
::GetApplicationDescription. This now shows either the application as given,
or, if that cannot be accessed like that, searches the PATH for it and if found
shows the full path+leaf name. If the PATH lookup fails I just took what is
there...

Because it is difficult to disentangle this from the work going on in bug
254320 I include the new stuff from there as well, so that this patch
supersedes attachment 164016 [details] [diff] [review].
Assignee: file-handling → mozilla
Status: NEW → ASSIGNED
Comment on attachment 165214 [details] [diff] [review]
patch adding GetApplicationDescription for OS/2

Javier, do you still do OS/2 reviews?
Attachment #165214 - Flags: review?(jhpedemonte)
Comment on attachment 165214 [details] [diff] [review]
patch adding GetApplicationDescription for OS/2

+  /* unsupported protocol scheme */
+  else {
+    return NS_ERROR_FAILURE;
+  }

Is it worth putting an assertion or warning here, so we know when the function
gets called for an unsupported protocol?  

+  /* application string in INI was empty */
+  if (strcmp(app, "\0") == 0)

You could just do "if (app[0] == '\0')".

+  if (GetApplicationAndParametersFromINI(nsDependentCString(aProtocolScheme),
+					  szAppFromINI, sizeof(szAppFromINI),
+					  szParamsFromINI,
sizeof(szParamsFromINI))
+      == NS_OK) {
+    *aHandlerExists = PR_TRUE;


Don't like this lengthy function call inside the if statement.	I think it
would look cleaner if you just saved the return value and checked it on a
different line.  You do this elsewhere in the patch, also.

At the end of the function GetApplicationDescription(), if
NS_NewNativeLocalFile and DosSearchPath both fail, then you would still return
NS_OK.	Is that your intent?
(In reply to comment #9)
> At the end of the function GetApplicationDescription(), if
> NS_NewNativeLocalFile and DosSearchPath both fail, then you would still return
> NS_OK.	Is that your intent?

Actually, yes. We then still have whatever will be passed to the OS and this
should be good enough to display in the warning message. That the call will most
likely fail later in ::LoadUriInternal is something else.

Will post a new patch with the other requested changes, thanks!
Attachment #165214 - Attachment is obsolete: true
Attachment #165343 - Flags: superreview?(mkaply)
Attachment #165343 - Flags: review?(jhpedemonte)
Attachment #165214 - Flags: review?(jhpedemonte)
Attachment #165343 - Flags: review?(jhpedemonte) → review+
Comment on attachment 165343 [details] [diff] [review]
better patch, changed following comments

sr=blizzard (platform specific)
a=mkaply for 1.8a5
Attachment #165343 - Flags: superreview?(mkaply) → superreview+
Fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: