Skip to content

Commit f7c632a

Browse files
committed
Bug 1878636 - remove filterPrivateTabs as it creates needless performance churn, r=sfoster,sessionstore-reviewers,kaya,farre
Differential Revision: https://phabricator.services.mozilla.com/D200687
1 parent 13ffecd commit f7c632a

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

browser/components/sessionstore/SessionStore.sys.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
222222
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
223223
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
224224
HomePage: "resource:///modules/HomePage.sys.mjs",
225-
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.sys.mjs",
226225
RunState: "resource:///modules/sessionstore/RunState.sys.mjs",
227226
SessionCookies: "resource:///modules/sessionstore/SessionCookies.sys.mjs",
228227
SessionFile: "resource:///modules/sessionstore/SessionFile.sys.mjs",
@@ -2320,8 +2319,6 @@ var SessionStoreInternal = {
23202319
// 3) When the flush is complete, revisit our decision to store the window
23212320
// in _closedWindows, and add/remove as necessary.
23222321
if (!winData.isPrivate) {
2323-
// Remove any open private tabs the window may contain.
2324-
lazy.PrivacyFilter.filterPrivateTabs(winData);
23252322
this.maybeSaveClosedWindow(winData, isLastWindow);
23262323
}
23272324

@@ -2343,9 +2340,6 @@ var SessionStoreInternal = {
23432340
// Save non-private windows if they have at
23442341
// least one saveable tab or are the last window.
23452342
if (!winData.isPrivate) {
2346-
// It's possible that a tab switched its privacy state at some point
2347-
// before our flush, so we need to filter again.
2348-
lazy.PrivacyFilter.filterPrivateTabs(winData);
23492343
this.maybeSaveClosedWindow(winData, isLastWindow, true);
23502344

23512345
if (!isLastWindow && winData.closedId > -1) {

toolkit/modules/sessionstore/PrivacyFilter.sys.mjs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -103,48 +103,12 @@ export var PrivacyFilter = Object.freeze({
103103
if (browserState.selectedWindow >= i) {
104104
browserState.selectedWindow--;
105105
}
106-
} else {
107-
// Remove private tabs from all open non-private windows.
108-
this.filterPrivateTabs(win);
109106
}
110107
}
111108

112109
// Remove private closed windows.
113110
browserState._closedWindows = browserState._closedWindows.filter(
114111
win => !win.isPrivate
115112
);
116-
117-
// Remove private tabs from all remaining closed windows.
118-
browserState._closedWindows.forEach(win => this.filterPrivateTabs(win));
119-
},
120-
121-
/**
122-
* Removes open private tabs from a given window state object.
123-
*
124-
* @param winState (object)
125-
* The window state for which we remove any private tabs.
126-
* The given object will be modified.
127-
*/
128-
filterPrivateTabs(winState) {
129-
// Remove open private tabs.
130-
for (let i = winState.tabs.length - 1; i >= 0; i--) {
131-
let tab = winState.tabs[i];
132-
133-
// Bug 1740261 - We end up with `null` entries in winState.tabs, which if
134-
// we don't check for we end up throwing here. This does not fix the issue of
135-
// how null tabs are getting into the state.
136-
if (!tab || tab.isPrivate) {
137-
winState.tabs.splice(i, 1);
138-
139-
if (winState.selected >= i) {
140-
winState.selected--;
141-
}
142-
}
143-
}
144-
145-
// Note that closed private tabs are only stored for private windows.
146-
// There is no need to call this function for private windows as the
147-
// whole window state should just be discarded so we explicitly don't
148-
// try to remove closed private tabs as an optimization.
149113
},
150114
});

0 commit comments

Comments
 (0)