зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1655285 - Part 2: Return an "Intel" User-Agent string on ARM64 macOS. r=smaug
Safari returns an "Intel" User-Agent string (and "MacIntel" navigator.platform) on ARM64 macOS (presumably for web compat) and on iPadOS (so sites serve desktop page layouts). We should follow Safari's lead for Firefox on ARM64 macOS. Note that I do not have an Apple Silicon DTK so I have not personally tested this change on ARM64 macOS. Based on visual inspection of our User-Agent string code, I expect Firefox's current User-Agent string on ARM64 macOS is "Mozilla/5.0 (Macintosh; Mac OS X 10.16; rv:80.0) Gecko/20100101 Firefox/80.0" (and navigator.oscpu is " Mac OS X 10.16"). Note the missing "Intel" and extra space before "Mac OS X". Example webcompat breakage even in mozilla-central: the Octane JS benchmark assumes Firefox's macOS navigator.platform will never return any values other than "MacIntel" or "MacPPC": https://searchfox.org/mozilla-central/rev/dcd9c2d2bc19d96d487825eb70c2333a4d60994e/js/src/octane/gbemu-part1.js#659-669 Differential Revision: https://phabricator.services.mozilla.com/D84912
This commit is contained in:
Родитель
6f377421d2
Коммит
25ffb2031c
|
@ -1845,9 +1845,8 @@ nsresult Navigator::GetPlatform(nsAString& aPlatform,
|
|||
// hardcoded and we are seeking backward compatibility here (bug 47080).
|
||||
#if defined(WIN32)
|
||||
aPlatform.AssignLiteral("Win32");
|
||||
#elif defined(XP_MACOSX) && defined(__i386__)
|
||||
aPlatform.AssignLiteral("MacIntel");
|
||||
#elif defined(XP_MACOSX) && defined(__x86_64__)
|
||||
#elif defined(XP_MACOSX)
|
||||
// Always return "MacIntel", even on ARM64 macOS like Safari does.
|
||||
aPlatform.AssignLiteral("MacIntel");
|
||||
#else
|
||||
// XXX Communicator uses compiled-in build-time string defines
|
||||
|
|
|
@ -483,8 +483,8 @@ nsresult nsHttpHandler::Init() {
|
|||
Preferences::RegisterPrefixCallbacks(nsHttpHandler::PrefsChanged,
|
||||
gCallbackPrefs, this);
|
||||
PrefsChanged(nullptr);
|
||||
Telemetry::ScalarSet(
|
||||
Telemetry::ScalarID::NETWORKING_HTTP3_ENABLED, mHttp3Enabled);
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::NETWORKING_HTTP3_ENABLED,
|
||||
mHttp3Enabled);
|
||||
|
||||
mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
|
||||
|
||||
|
@ -1061,13 +1061,13 @@ void nsHttpHandler::InitUserAgentComponents() {
|
|||
}
|
||||
}
|
||||
# elif defined(XP_MACOSX)
|
||||
# if defined(__i386__) || defined(__x86_64__)
|
||||
mOscpu.AssignLiteral("Intel Mac OS X");
|
||||
# endif
|
||||
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
|
||||
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
|
||||
mOscpu += nsPrintfCString(" %d.%d", static_cast<int>(majorVersion),
|
||||
static_cast<int>(minorVersion));
|
||||
|
||||
// Always return an "Intel" UA string, even on ARM64 macOS like Safari does.
|
||||
mOscpu =
|
||||
nsPrintfCString("Intel Mac OS X %d.%d", static_cast<int>(majorVersion),
|
||||
static_cast<int>(minorVersion));
|
||||
# elif defined(XP_UNIX)
|
||||
struct utsname name;
|
||||
int ret = uname(&name);
|
||||
|
|
Загрузка…
Ссылка в новой задаче