Open Bug 1787471 Opened 2 years ago Updated 2 years ago

Improve experience when debugging shutdown scripts

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

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:

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:

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?

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.

Priority: -- → P3
Whiteboard: [devtools-triage]
Blocks: dbg-browser

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&regexp=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.

You need to log in before you can comment on or make changes to this bug.