termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.34k stars 3.07k forks source link

fix(x11/firefox): fix Segmentation fault in the command "firefox -headless" #22287

Open robertkirkman opened 5 days ago

robertkirkman commented 5 days ago

Fixes #22286

Bypasses the unstable codepath by disabling MOZ_HAS_REMOTE, which does not seem to negatively affect the behavior of the X11 mode. It only fixes the command firefox -headless; I am not 100% sure that nobody else needs MOZ_HAS_REMOTE to be enabled, but disabling it fixes firefox -headless and does not seem to break anything obvious that I have noticed from browsing with the X11 mode for a few minutes.

This patch is a dependency of my project, "How To Run Node.js Puppeteer On Android" https://gist.github.com/robertkirkman/0c2f3426024069546ed9b7bb2f26cb99, which is a fully functional example of a Javascript program that invokes the system call firefox -headless through the Puppeteer library. I am hoping to possibly upstream the patch part of the necessary code for the headless mode on Termux of the Firefox backend of the Puppeteer Node.js library by submitting this PR.

TomJo2000 commented 1 day ago

Should be ready to merge. I'll take a final look in the morning.

If another maintainer wants to merge it before I get to that, feel free to.

robertkirkman commented 1 day ago

Unfortunately, I have discovered an undesirable bug introduced by this PR.

While this fixes the command firefox -headless, it breaks the command firefox & sleep 5 && firefox google.com, which currently works, but after this change would create a popup "firefox is running but is not responding".

I would not really feel comfortable about introducing something like that so I will mark this as draft until I can figure out if there is any alternative way to write this that does not break the command firefox & sleep 5 && firefox google.com.