Open Bug 1230636 Opened 9 years ago Updated 2 years ago

Make forgetting tabs during an async flush work like forgetting windows

Categories

(Firefox :: Session Restore, defect)

defect

Tracking

()

People

(Reporter: mconley, Unassigned)

References

Details

Bug 1225921 added a mechanism that prevents us from accidentally remembering and storing a window in the _closedWindows array after forgetClosedWindow or a history purge occurs.

The mechanism works by adding the "maybe saveable" closed window data in a WeakSet, and only save the window after the flush if it's still in the WeakSet. When forgetClosedWindow or a history purge occurs, we remove the data from the WeakSet.

Tabs have a mechanism that prevents us from remembering them for the same cases, but it's a little harder to understand. Basically, what happens is that the closedTabs array on a window gets overwritten with a new array, so that after a flush, a tab that wants to get put into the closedTabs array ends up inserting it into an array that the window doesn't care about anymore. It's not immediately obvious and took a little while to understand.

I proposed to billm that we should make the closed tab mechanism work more like the closed window one, since it's more explicit and easier to understand, and he agreed here: https://bugzilla.mozilla.org/show_bug.cgi?id=1225921#c8

So filing this bug to do that work.
Depends on: 1225921
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.