As described in bug 1547081, being able to take recordings that were made on macOS and replay them on linux is a major part of the plan for cloud integration. I've looked into several ways of doing this, and I think I've found a pretty clean approach that doesn't require any changes to the firefox build system. I'd like an application targeting linux which takes as input the recording and the firefox binaries used to make the recording (plugin-container, XUL, libmozglue, libnss3, liblgpllibs, i.e. nothing that violates Apple's EULA). The application loads these binaries and links them to a set of stubs that either emulate the calls with native linux library functions (for pthreads etc.) or simply crash when being called. Functions in the latter bucket need to be redirected as part of the recording; when replaying these stubs will be redirected by the existing machinery and produce recorded information when they are called.
This design is similar to what Wine does (run windows software on linux by linking it against a set of functions emulating windows APIs). There is already a Wine-like project for running macOS software on linux, Darling (https://www.darlinghq.org/), though it doesn't support GUIs yet. The job here is much simpler than what Wine or Darling need to do, however, because we only need to emulate a small set of APIs and can rely on the recording to deal with the great bulk of the interactions between the replaying process and the system.
The main difficulty here is that macOS and linux have different binary formats (Mach-O vs. ELF). In order to load the binaries, the application needs to understand Mach-O and perform the appropriate dynamic linking steps. This seems intimidating at first but is actually not too hard and kind of fun. The Mach-O format is reasonably well documented, with open source headers and a linker implementation from Apple (APSL licensed, which is similar to BSD/MIT if you don't modify the code) and a number of third party tools for operating on binaries (none of which seem reusable here, but which are good for referencing).
The application performing this linking does not need to be compiled into firefox and its source can live in a separate place. I've started a github repository here:
Some changes to mozilla-central/toolkit/recordreplay will be needed as well.
Disclaimer: work I'm doing on web replay is done on my own time, and is not part of my official work at mozilla. If you have a problem with me working on this, please talk to me directly.