Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit fe05ee7

Browse files
authored
Make sure session listeners are set when LoadRequest is called (#3265)
1 parent 6ee1a8e commit fe05ee7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,12 +1117,9 @@ public void setSession(@NonNull Session aSession, @OldSessionDisplayAction int a
11171117
} else {
11181118
onCurrentSessionChange(null, aSession.getGeckoSession());
11191119
}
1120-
setupListeners(mSession);
11211120
for (WindowListener listener: mListeners) {
11221121
listener.onSessionChanged(oldSession, aSession);
11231122
}
1124-
1125-
11261123
}
11271124
mCaptureOnPageStop = false;
11281125
hideLibraryPanels();
@@ -1152,6 +1149,7 @@ public void onStackSession(Session aSession) {
11521149
// e.g. tab opened via window.open()
11531150
aSession.updateLastUse();
11541151
Session current = mSession;
1152+
setupListeners(aSession);
11551153
setSession(aSession);
11561154
SessionStore.get().setActiveSession(aSession);
11571155
current.captureBackgroundBitmap(getWindowWidth(), getWindowHeight()).thenAccept(aVoid -> current.setActive(false));
@@ -1164,6 +1162,7 @@ public void onStackSession(Session aSession) {
11641162
public void onUnstackSession(Session aSession, Session aParent) {
11651163
if (mSession == aSession) {
11661164
aParent.setActive(true);
1165+
setupListeners(aParent);
11671166
setSession(aParent);
11681167
SessionStore.get().setActiveSession(aParent);
11691168
SessionStore.get().destroySession(aSession);

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,9 @@ public void onTabSelect(Session aTab) {
12111211
Session moveTo = targetWindow.getSession();
12121212
moveFrom.surfaceDestroyed();
12131213
moveTo.surfaceDestroyed();
1214+
windowToMove.setupListeners(moveTo);
12141215
windowToMove.setSession(moveTo, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
1216+
targetWindow.setupListeners(moveFrom);
12151217
targetWindow.setSession(moveFrom, WindowWidget.SESSION_DO_NOT_RELEASE_DISPLAY);
12161218
SessionStore.get().setActiveSession(targetWindow.getSession());
12171219
windowToMove.setActiveWindow(false);
@@ -1220,6 +1222,7 @@ public void onTabSelect(Session aTab) {
12201222
} else {
12211223
setFirstPaint(targetWindow, aTab);
12221224
targetWindow.getSession().setActive(false);
1225+
targetWindow.setupListeners(aTab);
12231226
aTab.setActive(true);
12241227
targetWindow.setSession(aTab);
12251228
SessionStore.get().setActiveSession(aTab);
@@ -1234,6 +1237,7 @@ public void addTab(@NonNull WindowWidget targetWindow, @Nullable String aUri) {
12341237
Session session = SessionStore.get().createSuspendedSession(aUri, targetWindow.getSession().isPrivateMode());
12351238
setFirstPaint(targetWindow, session);
12361239
targetWindow.getSession().setActive(false);
1240+
targetWindow.setupListeners(session);
12371241
session.setActive(true);
12381242
targetWindow.setSession(session);
12391243
if (aUri == null || aUri.isEmpty()) {
@@ -1297,6 +1301,7 @@ public void onTabsClose(ArrayList<Session> aTabs) {
12971301
Session tab = available.get(0);
12981302
if (tab != null) {
12991303
setFirstPaint(window, tab);
1304+
window.setupListeners(tab);
13001305
tab.setActive(true);
13011306
window.setSession(tab);
13021307
}
@@ -1336,6 +1341,7 @@ public void onTabsReceived(@NonNull List<TabData> aTabs) {
13361341
if (i == 0 && !fullscreen) {
13371342
// Set the first received tab of the list the current one.
13381343
SessionStore.get().setActiveSession(session);
1344+
targetWindow.setupListeners(session);
13391345
targetWindow.getSession().setActive(false);
13401346
targetWindow.setSession(session);
13411347
}

0 commit comments

Comments
 (0)