Bug 1188550 - Don't directly use MOZ_APP_DISPLAYNAME in User-Agent headers. r=vivek,nalexander.

It is possible for the display name to contain Unicode characters,
which not all Mozilla service endpoints handle gracefully.  This
avoids that issue.

--HG--
extra : commitid : JhI3YFLj4Ho
extra : rebase_source : 7f60fb1dfdb70b3e25aa5220f61d553895294c8c
This commit is contained in:
Kalpesh Krishna 2015-11-09 10:53:37 -08:00
parent ad6867e19d
commit e688976ffe
6 changed files with 7 additions and 5 deletions

View File

@ -103,6 +103,8 @@ public class AppConstants {
public static final String MOZ_APP_VENDOR = "@MOZ_APP_VENDOR@";
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String MOZ_APP_DISPLAYNAME = "@MOZ_APP_DISPLAYNAME@";
// MOZ_APP_UA_NAME is already quoted when it gets substituted, like MOZILLA_VERSION.
public static final String MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@;
// MOZILLA_VERSION is already quoted when it gets substituted in. If we
// add additional quotes we end up with ""x.y"", which is a syntax error.

View File

@ -12,7 +12,7 @@ import org.mozilla.gecko.AppConstants;
*/
public class ReadingListConstants {
public static final String GLOBAL_LOG_TAG = "FxReadingList";
public static final String USER_AGENT = "Firefox-Android-FxReader/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-FxReader/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_UA_NAME + ")";
public static final String DEFAULT_DEV_ENDPOINT = "https://readinglist.dev.mozaws.net/v1/";
public static final String DEFAULT_PROD_ENDPOINT = "https://readinglist.services.mozilla.com/v1/";

View File

@ -11,7 +11,7 @@ public class HealthReportConstants {
public static final String HEALTH_AUTHORITY = AppConstants.ANDROID_PACKAGE_NAME + ".health";
public static final String GLOBAL_LOG_TAG = "GeckoHealth";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-HealthReport/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_UA_NAME + ")";
/**
* The earliest allowable value for the last ping time, corresponding to May 2nd 2013.

View File

@ -37,7 +37,7 @@ public class FxAccountConstants {
// You must wait 15 minutes after failing an age check before trying to create a different account.
public static final long MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS = 15 * 60 * 1000;
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_UA_NAME + ")";
public static final String ACCOUNT_PICKLE_FILENAME = "fxa.account.json";

View File

@ -888,7 +888,7 @@ for var in ('MOZ_UPDATER', 'MOZ_PKG_SPECIAL', 'MOZ_ANDROID_GCM_SENDERID'):
for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH',
'GRE_MILESTONE', 'MOZ_APP_BASENAME', 'MOZ_MOZILLA_API_KEY',
'MOZ_APP_DISPLAYNAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
'MOZ_APP_DISPLAYNAME', 'MOZ_APP_UA_NAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',
'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS',
'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',

View File

@ -16,7 +16,7 @@ public class SyncConstants {
public static final String USER_AGENT = "Firefox AndroidSync " +
SYNC_VERSION_STRING + " (" +
AppConstants.MOZ_APP_DISPLAYNAME + ")";
AppConstants.MOZ_APP_UA_NAME + ")";
public static final String ACCOUNTTYPE_SYNC = AppConstants.MOZ_ANDROID_SHARED_ACCOUNT_TYPE;