Open Bug 969009 Opened 10 years ago Updated 2 years ago

mach should respect user's default browser for resource-usage

Categories

(Firefox Build System :: General, defect)

x86_64
Linux
defect

Tracking

(Not tracked)

People

(Reporter: ato, Unassigned)

References

Details

Attachments

(1 file)

python/mozbuild/mozbuild/mach_commands.py:488 sets "firefox" as the default argument to give to the webbrowser library.  The nice thing to do would be to respect the user's system's default browser choice, which on Linux might be x-www-browser.

In my use case I have x-www-browser set to firefox-trunk, and not firefox.  Since the webbrowser library is clever enough to figure this out for itself, I think the best action would be to defer the browser choice to that.
Assignee: nobody → ato
Status: NEW → ASSIGNED
IIRC, webbrowser makes bad decisions on mac.
It will also choose lynx, etc on SSH connections, even if X11 is working and firefox is available.

This is prime use case for a mach config file.
OK, would a better solution be to not trust webbrowser's deduction then and supply our own?  It seems reasonable that we want to check x-www-browser or fall back to "firefox" if unavailable or on Mac or Windows.

I could use webbrowser.register(name, constructor[, instance]) to register a new entry.
It is rather tempting to use the newly-built binary for rendering things. But that binary may not always be a host native browser application.

I don't think we should be in the business of chasing the tail of every one-off configuration out there. I'd much rather we just do mach config files properly and leave this to the user's discretion.

That being said, your idea of a custom routine for deducing the browser is tempting. The built-in code, for example, doesn't know about Nightly, Aurora, or Beta. I don't have Firefox.app on my Macbook Pro, so the current implementation fails unless I run with |--browser safari| or similar.

Why don't you work on a custom webbrowser.register routine. I think that will make everyone happy for the time-being.
Status: ASSIGNED → NEW
Comment on attachment 8371711 [details] [diff] [review]
0001-Bug-969009-Defer-browser-choice-for-resource-usage-t.patch

Let's pursue webbrowser.register.
Attachment #8371711 - Flags: review?(gps)
So I did some investigation into this and for me webbrowser does the right thing when called over an SSH connection with X11 forwarding enabled.  It checks for the DISPLAY environmental variable and if set, it will register the graphical browsers [1] with a preference for them over the shell-based ones.

By default it will use the xdg-open program which seems to be forwarding aware since it resolves to firefox-trunk on the local system when executed on an X11 forwarding enabled connection.

It doesn't register Nightly, Aurora, or Beta which might be good to extend it to support.

(In reply to Mike Hommey [:glandium] from comment #2)
> IIRC, webbrowser makes bad decisions on mac.

Can you elaborate a bit on what the bad decisions it makes on Mac are?

1. http://hg.python.org/cpython/file/2.7/Lib/webbrowser.py#l516
I doubt Python will want to extend the standard library to discover non-production browsers.

Let's just add a routine that teaches it how to discover Nightly, Aurora, and Beta and call it a day.
Assignee: ato → nobody
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: