Handle command line urls

RESOLVED FIXED in Thunderbird1.1

Status

Thunderbird
Mail Window Front End
RESOLVED FIXED
14 years ago
13 years ago

People

(Reporter: Scott MacGregor, Assigned: Scott MacGregor)

Tracking

unspecified
Thunderbird1.1
PowerPC
Mac OS X

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-aviary-1.0)

Attachments

(4 attachments)

(Assignee)

Description

14 years ago
You should be able to invoke thunderbird with just a url (could be mailto, news,
snews, etc) without passing in a commmand line handler.

this would help OSX properly load thunderbird when the user clicks on a mailto
url since the apple event always looks like:

./thunderbird-bin <url>

(FYI, on windows, we write the following key to the registry: 
   thunderbird -compose <url>
 which does work today)

See Bug #228484 for more details about the mac problems this bug causes.
(Assignee)

Updated

14 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → Thunderbird0.6
(Assignee)

Comment 1

14 years ago
Created attachment 141547 [details] [diff] [review]
first cut at a fix

Some more polish work needs to happen here but you get the idea.

Don, you want to try this patch on your mac build? It should make things work
if thunderbird is already running and you click on a mailto url. i.e. the apple
event entry path. Not sure if it works for 

./thunderbird-bin mailto:test.com

so try that too.

Updated

14 years ago
OS: Windows XP → MacOS X
Hardware: PC → Macintosh

Comment 2

14 years ago
*** Bug 221077 has been marked as a duplicate of this bug. ***
(Assignee)

Comment 3

14 years ago
I checked this into the 0.6 branch. It still needs to land in the trunk in some
form so I'll leave it open.

Feel free to verify in 0.6:

http://ftp.mozilla.org/pub/mozilla.org/thunderbird/nightly/latest-0.6/

Target Milestone: Thunderbird0.6 → Thunderbird0.7
(Assignee)

Comment 4

14 years ago
Created attachment 150410 [details] [diff] [review]
aviary 1.0 friendly version of the patch

this ports the same fix to the aviary 1.0 branch but with Thunderbird ifdefs
wrapped around the new code to ensure we don't break firefox with our new
behavior.
(Assignee)

Comment 5

14 years ago
I just ported this to the 1.0 branch. leaving open and moving out so we can
figure out what to do on the trunk. 
Target Milestone: Thunderbird0.7 → Thunderbird0.9
This will also be an issue for GNOME.  I'd like to not put -compose in the
command string that's associated with mailto: because for the firefox 'Read
Mail' button I'd like to just invoke the mailto handler with no URL.  If that
includes -compose, it will bring up an empty compose window.
(Assignee)

Updated

14 years ago
Whiteboard: fixed-aviary-1.0
(Assignee)

Updated

14 years ago
Target Milestone: Thunderbird0.9 → Thunderbird1.1
(Assignee)

Comment 7

13 years ago
*** Bug 291373 has been marked as a duplicate of this bug. ***
(Assignee)

Comment 8

13 years ago
cc'ing the toolkit guys to help figure out what the right thing to do here is
for the trunk. 

The patch I made for the 1.0 branch that is shown here gets the apple event and
instead of calling OpenBrowserWindow, actually acts like the xremote service and
trys to 'open' the url, letting any open window that is registered for the
content type of the url handle it instead of forcing it into a browser window. 

Comment 9

13 years ago
Since tbird is now in charge of handling its own commandline args in
nsMailDefaultHandler.js, this shouldn't be too hard. See my comment at
http://lxr.mozilla.org/mozilla/source/mail/components/nsMailDefaultHandler.js#216
(Assignee)

Comment 10

13 years ago
so maybe we just need to make sure the apple events end up going through this
and then modify it to handle the asynch call to openURI and hopefully all will
be well. 
(Assignee)

Comment 11

13 years ago
on the trunk the apple events are still trying to create a browser instance
instead of going through the new command line handling code so we need to start
poking there first, getting it to go through nsMailDefaultHandler.js.
(Assignee)

Comment 12

13 years ago
when the app is already running the apple event ends up triggering:

http://lxr.mozilla.org/mozilla/source/toolkit/xre/nsCommandLineServiceMac.cpp#293

which is still hard coded to look for navigator.xul instead of just trying to
open the URL.
(Assignee)

Comment 13

13 years ago
Created attachment 182194 [details] [diff] [review]
fix for the scenario where thunderbird is already running

this simple change fixes the case where we receive an apple event (i.e.
thunderbird is alread running) in nsCommandLineServicesMac::HandleEvent.

we set browser.chrome to the url for messengercompose.xul. Now HandleEvent
creates our chrome instead of trying to bring up navigator.xul.

We still aren't opening up a compose window when thunderbird is not already
running. I'm still debugging that.
(Assignee)

Comment 14

13 years ago
Created attachment 182204 [details] [diff] [review]
fix for the scenario where thunderbird is not yet running

Mac OS X passes "-url mailto:mscott@mozilla.org" into the command line when you
click on a mailto url in an application when thunderbird is not already
running. So I made the compose window command line handler process url in
addition to -compose (which is what windows passes in). This made the compose
handler jump up and handle the default args instead of flowing through the
default command line handler for mail.

If someone else in mail becomes interested in handling "-url <some url>" then
I'll have to make this change smarter by only trapping -url mailto:some url.
(Assignee)

Updated

13 years ago
Attachment #182204 - Flags: review?(benjamin)
(Assignee)

Comment 15

13 years ago
Comment on attachment 182194 [details] [diff] [review]
fix for the scenario where thunderbird is already running

this fixes the case where thunderbird is already running and we were coming in
through nsCommandLineMacServices::HandleEvent with a url. 

Instead of trying to open navigator.xul, use messengercompose.xul which knows
how to handle an argument.
Attachment #182194 - Flags: review?(benjamin)

Comment 16

13 years ago
Comment on attachment 182194 [details] [diff] [review]
fix for the scenario where thunderbird is already running

As a hack, this is fine... not ideal, and we should fix it to use the uriloader
at some point soon.
Attachment #182194 - Flags: review?(benjamin) → review+

Comment 17

13 years ago
Comment on attachment 182204 [details] [diff] [review]
fix for the scenario where thunderbird is not yet running

Again, we should probably replace this with uriloader calls in
nsMailCommandLineHandler.js, but it's a fine hack.
Attachment #182204 - Flags: review?(benjamin) → review+
(Assignee)

Updated

13 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.