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
--- 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;
}
}