Bug 905088 - Properly handle default URL on BrowserApp's enterEditingMode (r=mcomella)
authorLucas Rocha <lucasr@mozilla.com>
Wed, 14 Aug 2013 23:40:35 +0100
changeset 143536 3eb68df2a650122ad83bf608d63d938b766f7f51
parent 143535 7e1b879c9857e75ef0b72ade7599318348ef8fa5
child 143537 8a36903511fd744beebe2bb41d358090e4c31760
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs905088
milestone26.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 905088 - Properly handle default URL on BrowserApp's enterEditingMode (r=mcomella)
mobile/android/base/BrowserApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1361,35 +1361,37 @@ abstract public class BrowserApp extends
         // Cancel pending favicon load task
         Favicons.getInstance().cancelFaviconLoad(faviconLoadId);
 
         // Reset favicon load state
         tab.setFaviconLoadId(Favicons.NOT_LOADING);
     }
 
     private void enterEditingMode() {
-        enterEditingMode(null);
+        String url = null;
+
+        final Tab tab = Tabs.getInstance().getSelectedTab();
+        if (tab != null) {
+            final String userSearch = tab.getUserSearch();
+
+            // Check to see if there's a user-entered search term,
+            // which we save whenever the user performs a search.
+            url = (TextUtils.isEmpty(userSearch) ? tab.getURL() : userSearch);
+        }
+
+        enterEditingMode(url);
     }
 
     /**
      * Enters editing mode for the current tab. This method will
      * always open the VISITED page on about:home.
      */
     private void enterEditingMode(String url) {
-        // If we don't have a specific url to show, show the current tab's url.
-        if (TextUtils.isEmpty(url)) {
-            Tab tab = Tabs.getInstance().getSelectedTab();
-            if (tab != null) {
-                // Check to see if there's a user-entered search term, which we save
-                // whenever the user performs a search.
-                url = tab.getUserSearch();
-                if (TextUtils.isEmpty(url)) {
-                    url = tab.getURL();
-                }
-            }
+        if (url == null) {
+            throw new IllegalArgumentException("Cannot handle null URLs in enterEditingMode");
         }
 
         final PropertyAnimator animator = new PropertyAnimator(300);
         animator.setUseHardwareLayer(false);
 
         mBrowserToolbar.startEditing(url, animator);
         showHomePagerWithAnimator(HomePager.Page.HISTORY, animator);