[tor-commits] [tor-browser/tor-browser-60.3.0esr-8.5-1] Bug 28640: Try showing the homepage after the distribution loads

gk at torproject.org gk at torproject.org
Fri Nov 30 07:21:03 UTC 2018


commit bd3d1614a144377b32f5f548ce235c8ae0fb01d8
Author: Matthew Finkel <Matthew.Finkel at gmail.com>
Date:   Thu Nov 29 23:44:43 2018 +0000

    Bug 28640: Try showing the homepage after the distribution loads
---
 .../base/java/org/mozilla/gecko/BrowserApp.java    | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
index 814b46f24295..9330a6ba9838 100644
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3155,6 +3155,29 @@ public class BrowserApp extends GeckoApp
         // Don't show any onFinish actions when hiding from this Activity.
         mFirstrunAnimationContainer.registerOnFinishListener(null);
         mFirstrunAnimationContainer.hide();
+
+        // This is a little hacky, but this ensures about:tor (or whichever homepage
+        // is configured) shows when the user closes the FirstRun panels.
+        String homepageUrl = Tabs.getHomepage(BrowserApp.this);
+
+        // If the homepage is already open in one of the tabs, then switch to that tab.
+        int homepage_index = Tabs.getInstance().isOpen(homepageUrl);
+        if (homepage_index != Tabs.INVALID_TAB_ID) {
+            Tabs.getInstance().selectTab(homepage_index);
+            return true;
+        }
+
+        // Open in the currently selected tab by default
+        int tab_flags = Tabs.LOADURL_NONE;
+
+        // If there's more than one tab open, then the user opened at least one of them.
+        // Don't modify their tabs and open a new tab for the homepage.
+        if (Tabs.getInstance().getDisplayCount() > 1) {
+            tab_flags = Tabs.LOADURL_NEW_TAB;
+        }
+
+        Tabs.getInstance().loadUrl(homepageUrl, tab_flags);
+
         return true;
     }
 





More information about the tor-commits mailing list