Bug 1038996 - Don't prepopulate the address bar with 'about:home', and 'about:privatebrowsing' on new tabs; they should be a placeholder. r=mcomella

This commit is contained in:
Jonathan Almeida [:jonalmeida]
2015-08-03 23:36:18 -07:00
parent 3428db1a93
commit 0ee32fc36d
3 changed files with 15 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
package org.mozilla.gecko.toolbar; package org.mozilla.gecko.toolbar;
import org.mozilla.gecko.AboutPages;
import org.mozilla.gecko.AppConstants.Versions; import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.CustomEditText; import org.mozilla.gecko.CustomEditText;
import org.mozilla.gecko.InputMethods; import org.mozilla.gecko.InputMethods;
@@ -122,7 +123,17 @@ public class ToolbarEditText extends CustomEditText
@Override @Override
public void setText(final CharSequence text, final TextView.BufferType type) { public void setText(final CharSequence text, final TextView.BufferType type) {
super.setText(text, type); final String textString = (text == null) ? "" : text.toString();
// If we're on the home or private browsing page, we don't set the "about" url.
final CharSequence finalText;
if (AboutPages.isAboutHome(textString) || AboutPages.isAboutPrivateBrowsing(textString)) {
finalText = "";
} else {
finalText = text;
}
super.setText(finalText, type);
// Any autocomplete text would have been overwritten, so reset our autocomplete states. // Any autocomplete text would have been overwritten, so reset our autocomplete states.
resetAutocompleteState(); resetAutocompleteState();

View File

@@ -184,7 +184,7 @@ abstract class BaseTest extends BaseRobocopTest {
// Send the keys for the URL we want to enter // Send the keys for the URL we want to enter
mSolo.clearEditText(urlEditView); mSolo.clearEditText(urlEditView);
mSolo.enterText(urlEditView, url); mSolo.typeText(urlEditView, url);
// Get the URL text from the URL bar EditText view // Get the URL text from the URL bar EditText view
final String urlBarText = urlEditView.getText().toString(); final String urlBarText = urlEditView.getText().toString();

View File

@@ -23,7 +23,7 @@ public final class testInputUrlBar extends BaseTest {
blockForGeckoReady(); blockForGeckoReady();
startEditingMode(); startEditingMode();
assertUrlBarText(mStringHelper.ABOUT_HOME_URL); assertUrlBarText("");
// Avoid any auto domain completion by using a prefix that matches // Avoid any auto domain completion by using a prefix that matches
// nothing, including about: pages // nothing, including about: pages
@@ -97,7 +97,7 @@ public final class testInputUrlBar extends BaseTest {
// URL bar should have forgotten about "uv" text. // URL bar should have forgotten about "uv" text.
startEditingMode(); startEditingMode();
assertUrlBarText(mStringHelper.ABOUT_HOME_URL); assertUrlBarText("");
int width = mDriver.getGeckoWidth() / 2; int width = mDriver.getGeckoWidth() / 2;
int y = mDriver.getGeckoHeight() / 2; int y = mDriver.getGeckoHeight() / 2;