Open Bug 1780430 Opened 2 years ago Updated 2 years ago

Restarting the browser through Cmd+Option+R shortcut doesn't re-open the Browser Toolbox

Categories

(DevTools :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: jaws, Unassigned)

References

(Blocks 1 open bug)

Details

STR:
./mach run --jsdebugger
Cmd option R

Expected:
Browser restarts and Browser Toolbox re-opened

Actual:
Browser restarts without the Browser Toolbox re-opened

Some work was done around Browser + BrowserToolbox restart in Bug 1594639 , Alex might remember specific issue around this?

Flags: needinfo?(poirot.alex)

Bug 1735748 will disable F5/Cmd+R in the browser toolbox, which was doing only a light reload, reloading only the current toplevel browser.xhtml document.
But this will enable Cmd+Alt+R, which do a full restart (process restart). There is still cases where the browser toolbox won't restart if you restart too quickly and session store didn't have time to save data to disk.

This is based on this key shortcut:
https://searchfox.org/mozilla-central/rev/15b656909e77d3048d4652b894f79a8c719b4b86/browser/base/content/browser-development-helpers.js#16-40
I tried to investigate a bit the SessionStore codebase but wasn't able to find any API to force writing SessionStore to disk before restart.
Jared, if you have any suggestion on how to do that, that would be super helpful!

Flags: needinfo?(poirot.alex)

(In reply to Alexandre Poirot [:ochameau] from comment #2)

I tried to investigate a bit the SessionStore codebase but wasn't able to find any API to force writing SessionStore to disk before restart.
Jared, if you have any suggestion on how to do that, that would be super helpful!

If you could dispatch an event when the Browser Toolbox opens, SessionStore could listen for it and trigger a delayed save. It wouldn't be guaranteed but would probably work for most cases, https://searchfox.org/mozilla-central/rev/15b656909e77d3048d4652b894f79a8c719b4b86/browser/components/sessionstore/SessionStore.jsm#1516-1519

Flags: needinfo?(poirot.alex)

Oh but wait, the session store codepath we are using is only trigerred when the user manually ask to restore its previous tabs:
https://searchfox.org/mozilla-central/rev/3aaca0a12a2d1463da54933bdbdae2f06fead06f/browser/components/sessionstore/SessionStore.jsm#3834
https://searchfox.org/mozilla-central/rev/3aaca0a12a2d1463da54933bdbdae2f06fead06f/browser/base/content/browser-menubar.inc#248

So that, if you weren't having any tab, you wouldn't even see the menu entry to restore tabs (nor devtools).

We should probably find some other ways to save and restore devtools state, which wouldn't be tied to tabs.

Flags: needinfo?(poirot.alex)

I'm now wondering which API we could be using. There must be some other component to save such state across reloads.
Or should we be using preferences? custom IndexedDB? custom file in profile?

(In reply to Alexandre Poirot [:ochameau] from comment #5)

I'm now wondering which API we could be using. There must be some other component to save such state across reloads.
Or should we be using preferences? custom IndexedDB? custom file in profile?

Hi Gijs,
Would you know any which can help with the question from Alex above?

Severity: -- → S3
Flags: needinfo?(gijskruitbosch+bugs)
Priority: -- → P3

(In reply to Julian Descottes [:jdescottes] from comment #6)

(In reply to Alexandre Poirot [:ochameau] from comment #5)

I'm now wondering which API we could be using. There must be some other component to save such state across reloads.
Or should we be using preferences? custom IndexedDB? custom file in profile?

Hi Gijs,
Would you know any which can help with the question from Alex above?

The answer to your question is, I think, XULStore.

Flags: needinfo?(gijskruitbosch+bugs)
You need to log in before you can comment on or make changes to this bug.