Bug 1268887 - DON'T USE: Always restore about:home panel
This is flawed, we shouldn't use this.
MozReview-Commit-ID: 9JPHsvSiwix
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -2624,29 +2624,24 @@ public class BrowserApp extends GeckoApp
return;
}
// History will only store that we were visiting about:home, however the specific panel
// isn't stored. (We are able to navigate directly to homepanels using an about:home?panel=...
// URL, but the reverse doesn't apply: manually switching panels doesn't update the URL.)
// Hence we need to restore the panel, in addition to panel state, here.
if (isAboutHome(tab)) {
- String panelId = AboutPages.getPanelIdFromAboutHomeUrl(tab.getURL());
- Bundle panelRestoreData = null;
- if (panelId == null) {
- // No panel was specified in the URL. Try loading the most recent
- // home panel for this tab.
- // Note: this isn't necessarily correct. We don't update the URL when we switch tabs.
- // If a user explicitly navigated to about:reader?panel=FOO, and then switches
- // to panel BAR, the history URL still contains FOO, and we restore to FOO. In most
- // cases however we aren't supplying a panel ID in the URL so this code still works
- // for most cases.
- panelId = tab.getMostRecentHomePanel();
- panelRestoreData = tab.getMostRecentHomePanelData();
- }
+ // It's possible that the about:home url contains a panelId, which can be retrieved using
+ // AboutPages.getPanelIdFromAboutHomeUrl(tab.getURL());
+ // This may be garbage if we're going back in history, but may be valid (if we're explicitly
+ // switching directly to e.g. the bookmarks panel. We therefore can't restore if a panelId
+ // has been supplied, therefore this code is WRONG.
+ final String panelId = tab.getMostRecentHomePanel();
+ final Bundle panelRestoreData = tab.getMostRecentHomePanelData();
+
showHomePager(panelId, panelRestoreData);
if (mDynamicToolbar.isEnabled()) {
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
}
} else {
hideHomePager();
}