Alex313031 / Mercury

Firefox fork with compiler optimizations and patches from Librewolf, Waterfox, and GNU IceCat.
https://thorium.rocks/mercury
Mozilla Public License 2.0
1.06k stars 25 forks source link

Child process #37

Open trimechee opened 11 months ago

trimechee commented 11 months ago

Hello, i hope to use this extension to open media player to play youtube videos and video from other sites :

https://github.com/andy-portmen/external-application-button/

the problem with firefox based browser, we can open video of the browser wih media player but there is child process in the background and when we close firefox, the media player closes , we hope our beloved Mercury browser will fix this big problem, chromium browsers doesnt have this problem, thank you !

gz83 commented 11 months ago

Thanks for the suggestion, CC Alex

@trimechee @Alex313031

trimechee commented 11 months ago

Thank you @gz83 @Alex313031 :) sadly it seems very very complicated as even impossible to fix this problem :( bu may be there is solution :

"As I have already stated, there is no fix for this (or at least I am not aware of a way to fix this). Firefox just opens all the executables as its own child process and when the parent process is getting closed, all the sub-processes are being closed. You can still play around with the NodeJS native client which is basically very simple JavaScript code and see if you can find a way to prevent this to happen. "

"[Firefox Only] Can you explain why all the applications executed from this extension in Firefox get closed when the browser is closed? Is there a way to prevent this from happening?

This behavior relates to how Firefox handles native applications as child processes of Firefox. When the parent process is closed, the operating system (Windows only) kills all the child processes, including those launched by this extension. There is no easy way to bypass this restriction. However, a workaround is to use a third-party program called RunFromProcess by NirSoft that can change the parent process of a child process. You can call this program instead of your native one and ask it to assign another parent process for the application. By doing this, when Firefox is closed, the os does not kill the child process because its parent is still running. You can set a persistent process such as "explorer.exe" as the parent to prevent it from being closed later."

https://webextension.org/listing/external-application-button.html