Bug 1038996 - Don't prepopulate the address bar with 'about:home', and 'about:privatebrowsing' on new tabs; they should be a placeholder. r=mcomella
☠☠ backed out by 97aba112e4a2 ☠ ☠
authorJonathan Almeida [:jonalmeida] <jalmeida@mozilla.com>
Mon, 03 Aug 2015 23:36:18 -0700
changeset 288308 f48f05a347fcfe62d28917896c905eb98c2112a9
parent 288307 55b6658ae0db54a3791f1544abe88016c1d5b6ab
child 288309 c9b41f67d8323d2b542fb468f38fd27b176b9c30
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1038996
milestone42.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 1038996 - Don't prepopulate the address bar with 'about:home', and 'about:privatebrowsing' on new tabs; they should be a placeholder. r=mcomella
mobile/android/base/AboutPages.java
mobile/android/base/toolbar/ToolbarEditText.java
mobile/android/tests/browser/robocop/BaseTest.java
mobile/android/tests/browser/robocop/StringHelper.java
mobile/android/tests/browser/robocop/testInputUrlBar.java
--- a/mobile/android/base/AboutPages.java
+++ b/mobile/android/base/AboutPages.java
@@ -41,16 +41,23 @@ public class AboutPages {
             return false;
         }
         // We sometimes append a parameter to "about:home" to specify which page to
         // show when we open the home pager. Discard this parameter when checking
         // whether or not this URL is "about:home".
         return HOME.equals(url.split("\\?")[0]);
     }
 
+    public static final boolean isPrivateHome(final String url) {
+        if (url == null || !url.startsWith(PRIVATEBROWSING)) {
+            return false;
+        }
+        return true;
+    }
+
     public static final String getPanelIdFromAboutHomeUrl(String aboutHomeUrl) {
         return StringUtils.getQueryParameter(aboutHomeUrl, PANEL_PARAM);
     }
 
     public static boolean isAboutReader(final String url) {
         return isAboutPage(READER, url);
     }
 
--- a/mobile/android/base/toolbar/ToolbarEditText.java
+++ b/mobile/android/base/toolbar/ToolbarEditText.java
@@ -1,15 +1,16 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.toolbar;
 
+import org.mozilla.gecko.AboutPages;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.CustomEditText;
 import org.mozilla.gecko.InputMethods;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnCommitListener;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener;
 import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener;
 import org.mozilla.gecko.util.GamepadUtils;
@@ -117,17 +118,27 @@ public class ToolbarEditText extends Cus
         } catch (NullPointerException e) {
             Log.e(LOGTAG, "InputMethodManagerService, why are you throwing"
                           + " a NullPointerException? See bug 782096", e);
         }
     }
 
     @Override
     public void setText(final CharSequence text, final TextView.BufferType type) {
-        super.setText(text, type);
+
+        // If we're on the home or private browsing page, we don't set the "about" url.
+        final String textString = text.toString();
+        final CharSequence finalText;
+        if (AboutPages.isAboutHome(textString) || AboutPages.isPrivateHome(textString)) {
+            finalText = "";
+        } else {
+            finalText = text;
+        }
+
+        super.setText(finalText, type);
 
         // Any autocomplete text would have been overwritten, so reset our autocomplete states.
         resetAutocompleteState();
     }
 
     @Override
     public void sendAccessibilityEventUnchecked(AccessibilityEvent event) {
         // We need to bypass the isShown() check in the default implementation
--- a/mobile/android/tests/browser/robocop/BaseTest.java
+++ b/mobile/android/tests/browser/robocop/BaseTest.java
@@ -179,17 +179,17 @@ abstract class BaseTest extends BaseRobo
 
     protected final void enterUrl(String url) {
         focusUrlBar();
 
         final EditText urlEditView = (EditText) mSolo.getView(R.id.url_edit_text);
 
         // Send the keys for the URL we want to enter
         mSolo.clearEditText(urlEditView);
-        mSolo.enterText(urlEditView, url);
+        mSolo.typeText(urlEditView, url);
 
         // Get the URL text from the URL bar EditText view
         final String urlBarText = urlEditView.getText().toString();
         mAsserter.is(url, urlBarText, "URL typed properly");
     }
 
     protected final Fragment getBrowserSearch() {
         final FragmentManager fm = ((FragmentActivity) getActivity()).getSupportFragmentManager();
--- a/mobile/android/tests/browser/robocop/StringHelper.java
+++ b/mobile/android/tests/browser/robocop/StringHelper.java
@@ -26,16 +26,17 @@ public class StringHelper {
     public final String ABOUT_BLANK_URL = "about:blank";
     public final String ABOUT_FIREFOX_URL;
     public final String ABOUT_RIGHTS_URL = "about:rights";
     public final String ABOUT_BUILDCONFIG_URL = "about:buildconfig";
     public final String ABOUT_FEEDBACK_URL = "about:feedback";
     public final String ABOUT_HEALTHREPORT_URL = "about:healthreport";
     public final String ABOUT_DOWNLOADS_URL = "about:downloads";
     public final String ABOUT_HOME_URL = "about:home";
+    public final String ABOUT_PRIVATE_BROWSING_URL = "about:privatebrowsing";
     public final String ABOUT_ADDONS_URL = "about:addons";
     public static final String ABOUT_LOGINS_URL = "about:logins";
     public final String ABOUT_ABOUT_URL = "about:about";
     public final String ABOUT_SCHEME = "about:";
 
     // About pages' titles
     public final String ABOUT_HOME_TITLE = "";
 
--- a/mobile/android/tests/browser/robocop/testInputUrlBar.java
+++ b/mobile/android/tests/browser/robocop/testInputUrlBar.java
@@ -18,17 +18,17 @@ import android.widget.EditText;
 public final class testInputUrlBar extends BaseTest {
     private Element mUrlBarEditElement;
     private EditText mUrlBarEditView;
 
     public void testInputUrlBar() {
         blockForGeckoReady();
 
         startEditingMode();
-        assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
+        assertUrlBarText("");
 
         // Avoid any auto domain completion by using a prefix that matches
         //  nothing, including about: pages
         mActions.sendKeys("zy");
         assertUrlBarText("zy");
 
         mActions.sendKeys("cd");
         assertUrlBarText("zycd");
@@ -92,17 +92,17 @@ public final class testInputUrlBar exten
 
         // Dismiss editing mode
         mSolo.goBack();
 
         waitForText(mStringHelper.TITLE_PLACE_HOLDER);
 
         // URL bar should have forgotten about "uv" text.
         startEditingMode();
-        assertUrlBarText(mStringHelper.ABOUT_HOME_URL);
+        assertUrlBarText("");
 
         int width = mDriver.getGeckoWidth() / 2;
         int y = mDriver.getGeckoHeight() / 2;
 
         // Slide to the right, force URL bar entry to lose input focus
         mActions.drag(width, 0, y, y);
 
         // Select text and replace the content