Firefox Add-ons(browser extension) is force closing native application window
Categories
(WebExtensions :: Untriaged, defect)
Tracking
(Not tracked)
People
(Reporter: write.to.raghav, Unassigned)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
2.48 MB,
image/gif
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
Steps to reproduce:
A mozilla add-on with native app messaging used to track downloaded files from a website and providing different actions to be taken on downloaded file.
One such action is to be able to Open the downloaded file.
When Open action is used it gets opened in the associated installed desktop application.
Actual results:
When Mozilla tab is closed the opened application also gets forced closed.
This happens when the installed desktop application is not running prior to opening it via mozilla add-on.
Expected results:
Closing the mozilla tab should not close the opened desktop application.
If child process which opens the installed application gets un-referenced it should not depend upon whether the installed application was already running or not.
Mozilla process model is not working as expected
Hi Raghav,
Can you please specify which is the mozilla add-on and which are the specific steps we need to follow in order to see the issue? We'd need to reproduce it on our end. You can find more information about bug reporting on this link: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines.
Please download Firefox Nightly from here: https://nightly.mozilla.org/ and retest the problem.
If you still have the issue please create a new profile, you have the steps here:https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles?redirectlocale=en-US&redirectslug=Managing-profiles#w_starting-the-profile-manager
Please test if the issue is reproducible in safe mode, here is a link that can help you: https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode.
If there is any other info you can provide to help us figure out how we can can reproduce the issue please share them.
Thanks for your contribution.
Steps to reproduce:
- Make sure MS office apps is not already running(not previously launched)
- Open Mozilla Firefox downloads page and open any previously downloaded document associated with MS office(PowerPoint etc)
- PowerPoint process gets launched as a child process of Firefox (the process ownership is retained by Firefox can be viewed by process explorer)
- Close Firefox.
- PowerPoint also gets closed.
Expected: launched app should be opened in a separate process.
This is a deviation from the Fire Fox process model
(In reply to Raghav from comment #2)
Steps to reproduce:
- Make sure MS office apps is not already running(not previously launched)
- Open Mozilla Firefox downloads page and open any previously downloaded document associated with MS office(PowerPoint etc)
- PowerPoint process gets launched as a child process of Firefox (the process ownership is retained by Firefox can be viewed by process explorer)
Expected: launched app should be opened in a separate process.
This is a deviation from the Fire Fox process model
Comment 4•5 years ago
|
||
Hey Raghaw,
Can you please mention the addons that manage your downloads? Tried to reproduce without any addons and LibreOffice but couldn't. Will try with MS Office too later and write back about it.
In the meantime, please provide the following info:
- Addon name that causes the issue
- Is this reproducible without any addons? Use safe mode to test this out, steps here: https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode.
Comment 5•5 years ago
|
||
It'd be really helpful to have a copy of the add-on, and to clarify what differences there are with the Chrome version which in bug 1573469 comment 9 is claimed to work fine.
Updated•5 years ago
|
Comment 6•5 years ago
|
||
(In reply to Raghav from bug 1573469 comment #13)
We have a native window app which is launched via Firefox extension and we read the following from Mozilla's documentation:
Mozilla kills the subprocesses if they do not break away
https://wiki.mozilla.org/Security/Sandbox/Process_model#Privileged_Content_Process
On Windows, the browser puts the native application's process into a Job object, and kills the job. If the native application launches any additional processes and wants them to remain open after the native application itself is killed, then the native application must launch the additional process with the CREATE_BREAKAWAY_FROM_JOB flag.
(This is from https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging in case people are wondering)
We are using ShellExecuteExW instead in the native app and suspect that it is inheriting some of Firefox's process attributes.
:zombie, do you know anything about native messaging and how subprocesses launched from the native messaging client work in Firefox vs. Chrome? In bug 1573469 comment 9 it's suggested we end up killing the processes launched by the native messaging process whereas Chrome doesn't.
what differences there are with the Chrome version
works on all chrome version fine, I am using chrome Version 76.0.3809.132 (Official Build) (64-bit) an Firefox 68.0.2 (64-bit).
Comment 9•5 years ago
|
||
Yes I believe this is on purpose, extensions that want to escape closing child processes should be using CreateProcess instead of ShellExecute on Windows, with appropriate flags as the docs mention, though in this case that would also require using FindExecutable to identify the actual app used for each file type.
I'm not familiar why Chrome behaves differently, nor how they manage to not just spam processes by default.
Reporter | ||
Comment 10•5 years ago
|
||
Not sure why FF should allow only createProcess API and leave out ShellExecute which fits most of the usage scenario.
The main issue is that it does not happen in Firefox if the installed application is already running, it's only when the installed application gets opened via Firefox for the first time which makes it weird.
Comment 11•5 years ago
|
||
(In reply to Raghav from comment #10)
The main issue is that it does not happen in Firefox if the installed application is already running, it's only when the installed application gets opened via Firefox for the first time which makes it weird.
That's not strange; the process that you're starting with shellexecute will just hand the data to the existing process and exit immediately - the existing process won't be affected by Firefox quitting because it was started differently.
Comment 12•5 years ago
|
||
Closing this as WONTFIX, this is by design, and changing it could potentially leave users with hundred of half-dead apps if they are not properly written.
Also, the workaround exists, so we'll just add it as a compatibility note to the docs.
Updated•5 years ago
|
Comment 13•2 years ago
|
||
Documentation needs addressed in Native application window closing clarification #18331
Updated•2 years ago
|
Description
•