Bug 1722833 - Add nsCocoaFeatures::OnMontereyOrLater(). r=mac-reviewers,spohl

Depends on D128616

Differential Revision: https://phabricator.services.mozilla.com/D128785
This commit is contained in:
Markus Stange 2021-10-18 21:29:42 +00:00
Родитель eb296ef5d2
Коммит a8d276a426
3 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -425,7 +425,7 @@ bool IsAppRunningFromDmg() {
return false;
}
const char* imageClass =
nsCocoaFeatures::macOSVersionMajor() >= 12 ? "AppleDiskImageDevice" : "IOHDIXHDDrive";
nsCocoaFeatures::OnMontereyOrLater() ? "AppleDiskImageDevice" : "IOHDIXHDDrive";
for (imageDrive = media; imageDrive; imageDrive = IOIteratorNext(iter)) {
if (IOObjectConformsTo(imageDrive, imageClass)) {
break;

Просмотреть файл

@ -23,6 +23,7 @@ class nsCocoaFeatures {
static bool OnMojaveOrLater();
static bool OnCatalinaOrLater();
static bool OnBigSurOrLater();
static bool OnMontereyOrLater();
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix = 0);

Просмотреть файл

@ -24,6 +24,7 @@
#define MACOS_VERSION_10_15_HEX 0x000A0F00
#define MACOS_VERSION_10_16_HEX 0x000A1000
#define MACOS_VERSION_11_0_HEX 0x000B0000
#define MACOS_VERSION_12_0_HEX 0x000C0000
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@ -165,12 +166,29 @@ bool Gecko_OnSierraExactly() { return nsCocoaFeatures::OnSierraExactly(); }
}
/* static */ bool nsCocoaFeatures::OnBigSurOrLater() {
// Account for the version being 10.16 (which occurs when the
// application is linked with an older SDK) or 11.0 on Big Sur.
// Account for the version being 10.16 or 11.0 on Big Sur.
// The version is reported as 10.16 if SYSTEM_VERSION_COMPAT is set to 1,
// or if SYSTEM_VERSION_COMPAT is not set and the application is linked
// with a pre-Big Sur SDK.
// Firefox sets SYSTEM_VERSION_COMPAT to 0 in its Info.plist, so it'll
// usually see the correct 11.* version, despite being linked against an
// old SDK. However, it still sees the 10.16 compatibility version when
// launched from the command line, see bug 1727624. (This only applies to
// the Intel build - the arm64 build is linked against a Big Sur SDK and
// always sees the correct version.)
return ((macOSVersion() >= MACOS_VERSION_10_16_HEX) ||
(macOSVersion() >= MACOS_VERSION_11_0_HEX));
}
/* static */ bool nsCocoaFeatures::OnMontereyOrLater() {
// This check only works if SYSTEM_VERSION_COMPAT is off, otherwise
// Monterey pretends to be 10.16 and is indistinguishable from Big Sur.
// In practice, this means that an Intel Firefox build can return false
// from this function if it's launched from the command line, see bug 1727624.
// This will not be an issue anymore once we link against the Big Sur SDK.
return (macOSVersion() >= MACOS_VERSION_12_0_HEX);
}
/* static */ bool nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix) {
return macOSVersion() >= GetVersion(aMajor, aMinor, aBugFix);