Bug 1058352 - Correctly specify "other" instead of "null" for non-built-in search engines. r=mfinkle

This commit is contained in:
Margaret Leibovic 2014-08-26 16:24:08 -07:00
parent 899fdc0fd9
commit 418d76fd43

View File

@ -37,7 +37,7 @@ public class SearchEnginePreference extends CustomListPreference {
private FaviconView mFaviconView;
// Search engine identifier specified by the gecko search service. This will be null
// Search engine identifier specified by the gecko search service. This will be "other"
// for engines that are not shipped with the app.
private String mIdentifier;
@ -123,7 +123,7 @@ public class SearchEnginePreference extends CustomListPreference {
* @return Identifier of built-in search engine, or "other" if engine is not built-in.
*/
public String getIdentifier() {
return (mIdentifier == null) ? "other" : mIdentifier;
return mIdentifier;
}
/**
@ -134,6 +134,11 @@ public class SearchEnginePreference extends CustomListPreference {
public void setSearchEngineFromJSON(JSONObject geckoEngineJSON) throws JSONException {
mIdentifier = geckoEngineJSON.getString("identifier");
// A null JS value gets converted into a string.
if (mIdentifier.equals("null")) {
mIdentifier = "other";
}
final String engineName = geckoEngineJSON.getString("name");
final SpannableString titleSpannable = new SpannableString(engineName);