Bug 1060544 - Post: add comment explaining how our about:home restoration is incorrect r?liuche draft
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 29 Apr 2016 16:02:49 +0200
changeset 357841 7cf09c0f54220718d166c3d1ac18925b191798bb
parent 357840 c462287c36786d7644b1523db1393b891945a9cf
child 519716 27379531423c6176b457c4e0a1f6863d3f1f5952
push id16858
push userahunt@mozilla.com
push dateFri, 29 Apr 2016 14:52:18 +0000
reviewersliuche
bugs1060544
milestone49.0a1
Bug 1060544 - Post: add comment explaining how our about:home restoration is incorrect r?liuche MozReview-Commit-ID: 30Q2KEPFyKL
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -2629,16 +2629,24 @@ public class BrowserApp extends GeckoApp
         // 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.
+                // We can't fix this directly since we can't ignore the panelId if we're explicitly
+                // loading a specific panel, and we currently can't distinguish between loading
+                // history, and loading new pages, see Bug 1268887
                 panelId = tab.getMostRecentHomePanel();
                 panelRestoreData = tab.getMostRecentHomePanelData();
             }
             showHomePager(panelId, panelRestoreData);
 
             if (mDynamicToolbar.isEnabled()) {
                 mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
             }