diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index a5c6fa511965..bf3d9a125f07 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -972,10 +972,12 @@ void nsHttpHandler::InitUserAgentComponents() { SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor(); SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor(); + // Cap the reported macOS version at 10.15 (like Safari) to avoid breaking + // sites that assume the UA's macOS version always begins with "10.". + int uaVersion = (majorVersion >= 11 || minorVersion > 15) ? 15 : minorVersion; + // Always return an "Intel" UA string, even on ARM64 macOS like Safari does. - mOscpu = - nsPrintfCString("Intel Mac OS X %d.%d", static_cast(majorVersion), - static_cast(minorVersion)); + mOscpu = nsPrintfCString("Intel Mac OS X 10.%d", uaVersion); # elif defined(XP_UNIX) struct utsname name; int ret = uname(&name);