How I run two Firefoxes at once and still have remote control

October 31, 2010

Given how Firefox remote control works on Unix, you might wonder how I routinely run two separate copies of Firefox and still have my remote control environment work reliably enough that I haven't pitched one of the copies out the window long ago.

In theory, the answer is Firefox's -no-remote argument. In practice this doesn't work quite the way you want it to. The problem is that a Firefox instance run with -no-remote will still register itself as a valid target for remote control, alongside your main browser. You can start your second Firefox without problems, but from then onwards your remote control attempts may go to it, not to your main browser where you (probably) want them.

So I cheat. One of my customizations is that I changed the source code to rename the X properties that my main browser uses for remote control, precisely so that I could run it alongside a normal Firefox without either clashing.

This is obviously only an option for people who compile Firefox from source, but you don't have to go that far; you can just edit the binary. There are two binary files that you need to edit, mozilla-xremote-client and, and in each you need to change the following strings:


It's easy to find the right place to change, because the strings are all embedded together in the binary. Obviously their lengths need to stay the same; my traditional change is to change the _MOZILLA bit to _MEZILLA.

(I use GNU Emacs in overwrite mode for all of my binary editing needs, but there are probably better alternatives.)

If you prefer to not make binary edits to Firefox, it turns out that there's another way to do it; Firefox's remote control code checks to see if the program, the user, and the profile match before sending a command off to the remote control target. Thus the simple way to avoid all of the remote control problems is to run your testing Firefox with a non-default profile name.

(Manipulating the user name is possible and perhaps easier; you can just set $LOGNAME in your cover script. However, I don't know if this has other effects on Firefox or things that you may start from inside it.)

Written on 31 October 2010.
« How I set up my isolated testing Firefox environment
Redirecting from HTTP to HTTPS is a bad security idea »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Oct 31 20:50:27 2010
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.