[tor-dev] How to run a headless second Firefox instance?

David Fifield david at bamsoftware.com
Wed Apr 9 06:29:25 UTC 2014

We talked a while ago about using a browser extension to make HTTPS
requests on behalf of a pluggable transport, so that the TLS doesn't
stand out as unusual (#11183). I have that working pretty well and you
can try it out. Using these bundles, you can run the meek pluggable
transport and the TLS layer looks just like Firefox, because it is


How it works: tor starts a wrapper program called
meek-client-torbrowser, which starts a second copy of firefox using a
separate profile.meek-http-helper. The second profile has some different
prefs (https://gitweb.torproject.org/user/dcf/tor-browser-bundle.git/blob/861e270c648439a02189604bdb6ef68e994b1f16:/Bundle-Data/beta/meek-http-helper-user.js)
and it runs the HTTP helper extension. The extension prevents a second
browser window from opening. Once the second firefox starts up,
meek-client-torbrowser runs meek-client and sets it up to communicate
using the browser helper.

What I need some advice on: In order to prevent a browser window from
opening in the second instance of firefox, the helper extension opens a
modal dialog and never returns. If the dialog is ever closed, the whole
browser is shut down. It looks like this (https://gitweb.torproject.org/pluggable-transports/meek.git/blob/d2de8adc0641a3bc021f905740a1bf2b6b7ee720:/firefox/components/main.js#l58):
        try {
            // Block forever.
            var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
            prompts.confirm(null, "Query", "Get down, get funky?");
        } finally {
            var app = Components.classes["@mozilla.org/toolkit/app-startup;1"]
It gets the job done, but it sucks because the first thing you see is
the dialog and you have to know not to close it. Is there a way to
accomplish the same thing (keep the browser running, but don't show a
browser window) without raising a conspicuous dialog?

David Fifield

More information about the tor-dev mailing list