зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1711628 - UA String: Remove unused MOZ_UA_OS_AGNOSTIC #ifdefs. r=hsivonen,necko-reviewers,dragana
The MOZ_UA_OS_AGNOSTIC #ifdefs were added for Firefox OS because it hoped to omit OS ("Firefox OS" or "Android") in its UA string. Differential Revision: https://phabricator.services.mozilla.com/D115331
This commit is contained in:
Родитель
f16b7b648f
Коммит
c085238382
|
@ -884,24 +884,22 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifndef MOZ_UA_OS_AGNOSTIC
|
||||
// Gather platform.
|
||||
mPlatform.AssignLiteral(
|
||||
# if defined(ANDROID)
|
||||
#if defined(ANDROID)
|
||||
"Android"
|
||||
# elif defined(XP_WIN)
|
||||
#elif defined(XP_WIN)
|
||||
"Windows"
|
||||
# elif defined(XP_MACOSX)
|
||||
#elif defined(XP_MACOSX)
|
||||
"Macintosh"
|
||||
# elif defined(XP_UNIX)
|
||||
#elif defined(XP_UNIX)
|
||||
// We historically have always had X11 here,
|
||||
// and there seems little a webpage can sensibly do
|
||||
// based on it being something else, so use X11 for
|
||||
// backwards compatibility in all cases.
|
||||
"X11"
|
||||
# endif
|
||||
);
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifdef ANDROID
|
||||
nsCOMPtr<nsIPropertyBag2> infoService =
|
||||
|
@ -909,9 +907,6 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
MOZ_ASSERT(infoService, "Could not find a system info service");
|
||||
nsresult rv;
|
||||
// Add the Android version number to the Fennec platform identifier.
|
||||
# if defined MOZ_WIDGET_ANDROID
|
||||
# ifndef MOZ_UA_OS_AGNOSTIC // Don't add anything to mPlatform since it's
|
||||
// empty.
|
||||
nsAutoString androidVersion;
|
||||
rv = infoService->GetPropertyAsAString(u"release_version"_ns, androidVersion);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -925,8 +920,7 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
mPlatform += NS_LossyConvertUTF16toASCII(androidVersion);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
// Add the `Mobile` or `Tablet` or `TV` token when running on device.
|
||||
bool isTablet;
|
||||
rv = infoService->GetPropertyAsBool(u"tablet"_ns, &isTablet);
|
||||
|
@ -947,9 +941,8 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
}
|
||||
#endif // ANDROID
|
||||
|
||||
#ifndef MOZ_UA_OS_AGNOSTIC
|
||||
// Gather OS/CPU.
|
||||
# if defined(XP_WIN)
|
||||
#if defined(XP_WIN)
|
||||
OSVERSIONINFO info = {sizeof(OSVERSIONINFO)};
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4996)
|
||||
|
@ -969,15 +962,15 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
}
|
||||
|
||||
const char* format;
|
||||
# if defined _M_X64 || defined _M_AMD64
|
||||
# if defined _M_X64 || defined _M_AMD64
|
||||
format = OSCPU_WIN64;
|
||||
# else
|
||||
# else
|
||||
BOOL isWow64 = FALSE;
|
||||
if (!IsWow64Process(GetCurrentProcess(), &isWow64)) {
|
||||
isWow64 = FALSE;
|
||||
}
|
||||
format = isWow64 ? OSCPU_WIN64 : OSCPU_WINDOWS;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
SmprintfPointer buf =
|
||||
mozilla::Smprintf(format, info.dwMajorVersion, info.dwMinorVersion);
|
||||
|
@ -985,7 +978,7 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
mOscpu = buf.get();
|
||||
}
|
||||
}
|
||||
# elif defined(XP_MACOSX)
|
||||
#elif defined(XP_MACOSX)
|
||||
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
|
||||
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
|
||||
|
||||
|
@ -995,7 +988,7 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
|
||||
// Always return an "Intel" UA string, even on ARM64 macOS like Safari does.
|
||||
mOscpu = nsPrintfCString("Intel Mac OS X 10.%d", uaVersion);
|
||||
# elif defined(XP_UNIX)
|
||||
#elif defined(XP_UNIX)
|
||||
struct utsname name;
|
||||
int ret = uname(&name);
|
||||
if (ret >= 0) {
|
||||
|
@ -1003,20 +996,19 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
buf = (char*)name.sysname;
|
||||
buf += ' ';
|
||||
|
||||
# ifdef AIX
|
||||
# ifdef AIX
|
||||
// AIX uname returns machine specific info in the uname.machine
|
||||
// field and does not return the cpu type like other platforms.
|
||||
// We use the AIX version and release numbers instead.
|
||||
buf += (char*)name.version;
|
||||
buf += '.';
|
||||
buf += (char*)name.release;
|
||||
# else
|
||||
# else
|
||||
buf += (char*)name.machine;
|
||||
# endif
|
||||
# endif
|
||||
|
||||
mOscpu.Assign(buf);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
mUserAgentIsDirty = true;
|
||||
|
|
|
@ -2603,11 +2603,6 @@ AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
|
|||
AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
|
||||
|
||||
AC_SUBST(MOZ_APP_MAXVERSION)
|
||||
AC_SUBST(MOZ_UA_OS_AGNOSTIC)
|
||||
if test -n "$MOZ_UA_OS_AGNOSTIC"; then
|
||||
AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
|
||||
fi
|
||||
|
||||
AC_SUBST(MOZ_PKG_SPECIAL)
|
||||
AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче