Improve experience when debugging shutdown scripts
Categories
(DevTools :: Debugger, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: jdescottes, Unassigned)
References
(Blocks 1 open bug)
Details
It is currently not possible to set breakpoints and debug some scripts which are involved in the shutdown of Firefox.
STRs:
- add
debugger;
at https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/toolkit/components/cleardata/ClearDataService.jsm#694 - run Firefox
- open the browser toolbox
- open private window
- go to google.com
- accept privacy popup (or do something which interacts with cookies if trying from non EU)
- close all windows/quit firefox
ER: Should break on debugger
AR: The BT closes
:krosylight who initially reported the issue was setting a C++ breakpoint at https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/dom/quota/QuotaManagerService.cpp#735 which is hit correctly and prevents Firefox from quitting
But nevertheless, the toolbox closes automatically.
I tried to poke at this and unplug as many close listeners as possible:
- https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/devtools/client/framework/browser-toolbox/Launcher.jsm#117
- https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/devtools/client/framework/browser-toolbox/window.js#222
- https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/devtools/startup/DevToolsStartup.jsm#1030
I also commented out the destroy codepaths for devtools-server and devtools-connection, and unplugged the codepath which leads to destroy the parent process target at https://searchfox.org/mozilla-central/rev/8dd35cd8f5284fbaa506aab02fe42fc87efb249e/devtools/server/actors/targets/window-global.js#991
With all that, I have a Browser Toolbox which persists after closing the original Firefox but I'm still unable to break. I am not sure if there are potential issues when trying to break on JS breakpoint while the thread is also paused due to a CPP breakpoint. I am also not sure if we can still communicate between the Browser Toolbox and the original Firefox at any point during the shutdown?
Reporter | ||
Comment 1•2 years ago
|
||
Discussed in the team triage:
Alex mentioned it could be a nice default behavior from the Browser Toolbox, and should not be too problematic as long as it is restricted to the Browser Toolbox.
Reporter | ||
Updated•2 years ago
|
Comment 2•2 years ago
|
||
We might be able to easily pause the destruction of firefox parent process via:
https://searchfox.org/mozilla-central/search?q=lastWindowClosingSurvi&path=&case=false®exp=false
Services.startup.enterLastWindowClosingSurvivalArea();
Services.startup.exitLastWindowClosingSurvivalArea();
Unfortunately, I suspect that it won't work from a content process.
This issue may also happen when closing a tab and destroying a content process.
It could be worth having some code to prevent any process from closing.
Description
•