Bug 1363074 - Part 2 - When skipping the selected tab during session restore, don't select a replacement if we're also opening an URL from our launch intent. r?walkingice draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Mon, 08 May 2017 21:55:07 +0200
changeset 574396 8454f469ef7481252bad3362a374fff7effff66e
parent 574395 3462857e6f7165f418f16637cb6569a1023d9ea5
child 627579 79cbacb8b8805be8afd7f67443cfb11e81b02f14
push id57691
push usermozilla@buttercookie.de
push dateMon, 08 May 2017 20:17:04 +0000
reviewerswalkingice
bugs1363074
milestone55.0a1
Bug 1363074 - Part 2 - When skipping the selected tab during session restore, don't select a replacement if we're also opening an URL from our launch intent. r?walkingice When starting up, ideally we want to only load the foreground tab, with all other tabs being created as delay-loaded "zombie" tabs that occupy minimal resources. To that extent, when restoring the previous session we need to know whether we're planning to open an additional, external tab for a URL received through the launch intent later on. If we do, we don't want to select any tab while restoring the previous session, as that selection is going to be overridden by the external tab anyway. Not selecting a tab from the previous session at this stage means that it can remain as a delay-loaded tab until it is eventually selected by the user. MozReview-Commit-ID: 1lWnOx0ZuNl
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -274,17 +274,17 @@ public abstract class GeckoApp
         public void onTabRead(final SessionTab sessionTab) {
             if (sessionTab.isAboutHomeWithoutHistory()) {
                 // This is a tab pointing to about:home with no history. We won't restore
                 // this tab. If we end up restoring no tabs then the browser will decide
                 // whether it needs to open about:home or a different 'homepage'. If we'd
                 // always restore about:home only tabs then we'd never open the homepage.
                 // See bug 1261008.
 
-                if (sessionTab.isSelected()) {
+                if (!loadingExternalURL && sessionTab.isSelected()) {
                     // Unfortunately this tab is the selected tab. Let's just try to select
                     // the first tab. If we haven't restored any tabs so far then remember
                     // to select the next tab that gets restored.
 
                     if (!Tabs.getInstance().selectLastTab()) {
                         selectNextTab = true;
                     }
                 }