mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1227444 - Remove a closed window from _windows right away without waiting for a flush to complete. r=billm
--HG-- extra : commitid : 2GzekGdayRH extra : rebase_source : 6699c8debfd267d11bdf246c40abc1fb01ebf25e extra : histedit_source : 5a80f5de541b6298e161e435e93bce2d00100adc
This commit is contained in:
parent
fb6e8e8446
commit
142699c76b
@ -1250,6 +1250,19 @@ var SessionStoreInternal = {
|
||||
// we don't want to save the busy state
|
||||
delete winData.busy;
|
||||
|
||||
// When closing windows one after the other until Firefox quits, we
|
||||
// will move those closed in series back to the "open windows" bucket
|
||||
// before writing to disk. If however there is only a single window
|
||||
// with tabs we deem not worth saving then we might end up with a
|
||||
// random closed or even a pop-up window re-opened. To prevent that
|
||||
// we explicitly allow saving an "empty" window state.
|
||||
let isLastWindow =
|
||||
Object.keys(this._windows).length == 1 &&
|
||||
!this._closedWindows.some(win => win._shouldRestore || false);
|
||||
|
||||
// clear this window from the list, since it has definitely been closed.
|
||||
delete this._windows[aWindow.__SSi];
|
||||
|
||||
// Now we have to figure out if this window is worth saving in the _closedWindows
|
||||
// Object.
|
||||
//
|
||||
@ -1265,7 +1278,7 @@ var SessionStoreInternal = {
|
||||
if (!winData.isPrivate) {
|
||||
// Remove any open private tabs the window may contain.
|
||||
PrivacyFilter.filterPrivateTabs(winData);
|
||||
this.maybeSaveClosedWindow(winData);
|
||||
this.maybeSaveClosedWindow(winData, isLastWindow);
|
||||
}
|
||||
|
||||
// The tabbrowser binding will go away once the window is closed,
|
||||
@ -1292,11 +1305,9 @@ var SessionStoreInternal = {
|
||||
// It's possible that a tab switched its privacy state at some point
|
||||
// before our flush, so we need to filter again.
|
||||
PrivacyFilter.filterPrivateTabs(winData);
|
||||
this.maybeSaveClosedWindow(winData);
|
||||
this.maybeSaveClosedWindow(winData, isLastWindow);
|
||||
}
|
||||
|
||||
// clear this window from the list
|
||||
delete this._windows[aWindow.__SSi];
|
||||
// Update the tabs data now that we've got the most
|
||||
// recent information.
|
||||
this.cleanUpWindow(aWindow, winData);
|
||||
@ -1313,7 +1324,6 @@ var SessionStoreInternal = {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Clean up the message listeners on a window that has finally
|
||||
* gone away. Call this once you're sure you don't want to hear
|
||||
@ -1345,22 +1355,19 @@ var SessionStoreInternal = {
|
||||
*
|
||||
* @param winData
|
||||
* The data for the closed window that we might save.
|
||||
* @param isLastWindow
|
||||
* Whether or not the window being closed is the last
|
||||
* browser window. Callers of this function should pass
|
||||
* in the value of SessionStoreInternal.atLastWindow for
|
||||
* this argument, and pass in the same value if they happen
|
||||
* to call this method again asynchronously (for example, after
|
||||
* a window flush).
|
||||
*/
|
||||
maybeSaveClosedWindow(winData) {
|
||||
maybeSaveClosedWindow(winData, isLastWindow) {
|
||||
if (RunState.isRunning) {
|
||||
// Determine whether the window has any tabs worth saving.
|
||||
let hasSaveableTabs = winData.tabs.some(this._shouldSaveTabState);
|
||||
|
||||
// When closing windows one after the other until Firefox quits, we
|
||||
// will move those closed in series back to the "open windows" bucket
|
||||
// before writing to disk. If however there is only a single window
|
||||
// with tabs we deem not worth saving then we might end up with a
|
||||
// random closed or even a pop-up window re-opened. To prevent that
|
||||
// we explicitly allow saving an "empty" window state.
|
||||
let isLastWindow =
|
||||
Object.keys(this._windows).length == 1 &&
|
||||
!this._closedWindows.some(win => win._shouldRestore || false);
|
||||
|
||||
// Note that we might already have this window stored in
|
||||
// _closedWindows from a previous call to this function.
|
||||
let winIndex = this._closedWindows.indexOf(winData);
|
||||
|
Loading…
Reference in New Issue
Block a user