Skip to content

Commit

Permalink
Ensure all windows are restored even if an FxA session gets filtered …
Browse files Browse the repository at this point in the history
…out (#3205)

Fixes #3204
  • Loading branch information
bluemarvin committed Apr 22, 2020
1 parent 0068d59 commit d3f3c9b
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit d3f3c9b

Please sign in to comment.