How remote commands work?

How does Firefox send and receive remote messages to another running instance? (What is disabled with --no-remote) Is this mechanism accessible from an add-on? What channels are used on each OS?

Thank you.

Firefox doesn’t send messages to other running instances. The -no-remote flag simply tells it that a command to run Firefox should start a new instance (only works if a different profile is also specified).

Such “remote commands” are not commands being sent between Firefox instances, but simply an operating system command to start Firefox, for example to open a website from a desktop icon, or open an html file from the file browser.

1 Like

I mean how another instance can be found… Isn’t Firefox sending some remote commands? (Possibly via OS interfaces)
https://dxr.mozilla.org/mozilla-central/source/toolkit/xre/nsAppRunner.cpp#3839
https://dxr.mozilla.org/mozilla-central/source/toolkit/xre/nsNativeAppSupportWin.cpp#639
https://dxr.mozilla.org/mozilla-central/source/widget/xremoteclient/XRemoteClient.cpp#415

The remote command implementation is necessarily platform-specific. For example, I think it uses DDE server (still?) on Windows. Is this what you’re looking for?

A few months ago I tried remoting on Windows and it wouldn’t work. I tried pretty hard. Checked some bugzilla topics and I’m pretty sure remote is not supported on Windows.

Lots of discussion in it here -

https://bugzilla.mozilla.org/show_bug.cgi?id=1080319

You’ll see my windows case examples in this topic as well.

If you need to find out what other profiles are running I have a js-ctypes solution, if you would like that let me know. The code is here - https://github.com/Noitidart/Profilist/

A quick reading through the mozilla-central code made me think that on GNU/Linux (X11) Firefox tries to check the used profiles before choosing a remote instance. However, it is well known that without --no-remote Firefox always uses a remote instance no matter the used profiles. How this can be explained? Is this different on other platforms? On X11, while I was doing some testing I had to use separate X servers (and some hacks) so that Firefox doesn’t find a remote instance.