Open Bug 1286077 Opened 5 years ago Updated 5 years ago

Don't clean up window message listeners for SessionStore if we're in the midst of a shutdown

Categories

(Firefox :: Session Restore, defect, P3)

defect

Tracking

()

People

(Reporter: mconley, Unassigned)

References

Details

In bug 1284687, I noticed that we weren't properly flushing the messages from each window, waiting for each browser to respond, and then collecting the updated window data to be written to disk for session shutdown.

We fixed that, but we noticed there's another scenario where we might lose some data. Specifically, from the point that the async window flush starts and we hide each window, to the point where the flushes for a window fully complete, if the browser (or an add-on) for some reason causes a window to close, we'll call SessionStoreInternal.cleanUpWindow, which resolves any flushes for that window and then removes the message listeners.

This means we could have the following scenario:

1. Windows A B and C are open.
2. Shutdown begins. A, B, and C receive flush messages for each of their browsers, and the windows become invisible.
3. Runnable in the browser is serviced, and closes B. The B flushes are all resolved, and the window finishes closing.
4. A finishes flushing.
5. C finishes flushing.

The Runnable in 3 caused us to close the window prematurely, which means we may have not gotten some last-minute messages from the browsers in that window. This opens a small window up for data loss.

Ideally, if a window closes during the async window flushes of a shutdown, we should not call SessionStoreInternal.cleanUpWindow on that window until the flushes have finished.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.