Bug 1352133 - Handle selected tab not yet existing when exiting BrowserSearch. r=nechen
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 28 Dec 2017 15:29:24 +0100
changeset 449504 b5679bcdadf8f9538b4e431df0031d601378d1a7
parent 449503 bfdc585f72b3a38e62272a963b2d17ac94f4f439
child 449505 1230c90d4d9945f2d9edf304ad876424f8ed1cbb
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnechen
bugs1352133
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1352133 - Handle selected tab not yet existing when exiting BrowserSearch. r=nechen Early during startup there might not be a selected tab yet, so we can't use its data to decide which home panel to show again. Fortunately showHomePager can be called with a null panelId, in which case it will eventually simply fall back to using the default home panel from our settings. MozReview-Commit-ID: GbmozJeYZVb
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
@@ -3136,20 +3136,30 @@ public class BrowserApp extends GeckoApp
         getWindow().setBackgroundDrawableResource(android.R.color.white);
     }
 
     private void hideBrowserSearch() {
         if (!mBrowserSearch.getUserVisibleHint()) {
             return;
         }
 
+        final Tab selectedTab = Tabs.getInstance().getSelectedTab();
+        final String panelId;
+        final Bundle panelData;
+        if (selectedTab != null) {
+            panelId = selectedTab.getMostRecentHomePanel();
+            panelData = selectedTab.getMostRecentHomePanelData();
+        } else {
+            panelId = null;
+            panelData = null;
+        }
+
         // To prevent overdraw, the HomePager is hidden when BrowserSearch is displayed:
         // reverse that.
-        showHomePager(Tabs.getInstance().getSelectedTab().getMostRecentHomePanel(),
-                Tabs.getInstance().getSelectedTab().getMostRecentHomePanelData());
+        showHomePager(panelId, panelData);
 
         mBrowserSearchContainer.setVisibility(View.INVISIBLE);
 
         getSupportFragmentManager().beginTransaction()
                 .hide(mBrowserSearch).commitAllowingStateLoss();
         mBrowserSearch.setUserVisibleHint(false);
 
         getWindow().setBackgroundDrawable(null);