Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all windows are restored even if an FxA session gets filtered out #3205

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ public void saveState() {
.filter(sessionState -> SAVE_BLACKLIST.stream().noneMatch(uri -> sessionState.mUri.startsWith(uri)))
.collect(Collectors.toCollection(ArrayList::new));
for (WindowWidget window : mRegularWindows) {
if (window.getSession() != null &&
SAVE_BLACKLIST.stream().noneMatch(uri -> window.getSession().getCurrentUri().startsWith(uri))) {
if (window.getSession() != null) {
WindowState windowState = new WindowState();
windowState.load(window, state, sessions.indexOf(window.getSession()));
windowState.load(window, state, state.tabs.indexOf(window.getSession().getSessionState()));
state.regularWindowsState.add(windowState);
}
}
Expand Down Expand Up @@ -303,12 +302,14 @@ public WindowWidget addWindow() {
return newWindow;
}

private WindowWidget addRestoredWindow(@NonNull WindowState aState, @NonNull Session aSession) {
private WindowWidget addRestoredWindow(@NonNull WindowState aState, @Nullable Session aSession) {
if (getCurrentWindows().size() >= MAX_WINDOWS) {
return null;
}

aSession.setActive(true);
if (aSession != null) {
aSession.setActive(true);
}
WindowWidget newWindow = createWindow(aSession);
newWindow.getPlacement().width = aState.textureWidth;
newWindow.getPlacement().height = aState.textureHeight;
Expand Down Expand Up @@ -709,6 +710,11 @@ private void restoreWindows() {
for (WindowState windowState : windowsState.regularWindowsState) {
if (windowState.tabIndex >= 0 && windowState.tabIndex < restoredSessions.size()) {
addRestoredWindow(windowState, restoredSessions.get(windowState.tabIndex));
} else if (windowState.tabIndex < 0) {
WindowWidget widget = addRestoredWindow(windowState, null);
if ((widget != null) && (widget.getSession() != null)) {
widget.getSession().loadHomePage();
}
}
}
mPrivateMode = !windowsState.privateMode;
Expand Down