Bug 762155 - Open keyword URLs without a search term. r=mfinkle

This commit is contained in:
Brian Nicholson 2012-11-13 11:37:33 -08:00
parent 6c3a6b14ac
commit 17e6a345ab

View File

@ -367,12 +367,20 @@ public class AwesomeBar extends GeckoActivity {
private void openUserEnteredAndFinish(String url) {
int index = url.indexOf(' ');
if (index != -1) {
String keywordUrl = BrowserDB.getUrlForKeyword(mResolver, url.substring(0, index));
if (keywordUrl != null && keywordUrl.contains("%s")) {
String search = URLEncoder.encode(url.substring(index + 1));
url = keywordUrl.replace("%s", search);
}
String keywordUrl = null;
String keywordSearch = null;
if (index == -1) {
keywordUrl = BrowserDB.getUrlForKeyword(mResolver, url);
keywordSearch = "";
} else {
keywordUrl = BrowserDB.getUrlForKeyword(mResolver, url.substring(0, index));
keywordSearch = url.substring(index + 1);
}
if (keywordUrl != null) {
String search = URLEncoder.encode(keywordSearch);
url = keywordUrl.replace("%s", search);
}
Intent resultIntent = new Intent();