Skip to content

Commit

Permalink
Merge pull request #162 from dbsoft/MacModern
Browse files Browse the repository at this point in the history
Update macOS version detection through 13 Ventura
  • Loading branch information
MrAlex94 authored Nov 10, 2022
2 parents efbad44 + d7f5814 commit 6c21719
Show file tree
Hide file tree
Showing 13 changed files with 304 additions and 162 deletions.
29 changes: 18 additions & 11 deletions browser/app/macbuild/Contents/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,29 @@
<string>public.app-category.productivity</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSEnvironment</key>
<dict>
<key>SYSTEM_VERSION_COMPAT</key>
<string>0</string>
</dict>
<key>LSMinimumSystemVersion</key>
<string>10.5.0</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSPrincipalClass</key>
<string>GeckoNSApplication</string>
<string>10.7.0</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSRequiresAquaSystemAppearance</key>
<true/>
<key>NSPrincipalClass</key>
<string>GeckoNSApplication</string>
<key>SMPrivilegedExecutables</key>
<dict>
<key>org.mozilla.updater</key>
<string>identifier "org.mozilla.updater" and ((anchor apple generic and certificate leaf[field.1.2.840.113635.100.6.1.9]) or (anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "43AQ936H96"))</string>
</dict>
<key>NSDisablePersistence</key>
<true/>
<key>MozillaDeveloperRepoPath</key>
<string>%MOZ_DEVELOPER_REPO_PATH%</string>
<key>MozillaDeveloperObjPath</key>
<string>%MOZ_DEVELOPER_OBJ_PATH%</string>
<key>NSDisablePersistence</key>
<true/>
<key>MozillaDeveloperRepoPath</key>
<string>%MOZ_DEVELOPER_REPO_PATH%</string>
<key>MozillaDeveloperObjPath</key>
<string>%MOZ_DEVELOPER_OBJ_PATH%</string>
</dict>
</plist>
8 changes: 4 additions & 4 deletions gfx/gl/GLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,8 @@ GLContext::InitWithPrefixImpl(const char* prefix, bool trygl)

#ifdef XP_MACOSX
if (mWorkAroundDriverBugs &&
nsCocoaFeatures::OSXVersionMajor() == 10 &&
nsCocoaFeatures::OSXVersionMinor() < 12)
nsCocoaFeatures::macOSVersionMajor() == 10 &&
nsCocoaFeatures::macOSVersionMinor() < 12)
{
if (mVendor == GLVendor::Intel) {
// see bug 737182 for 2D textures, bug 684882 for cube map textures.
Expand Down Expand Up @@ -1725,8 +1725,8 @@ GLContext::InitExtensions()
// textures with glCompressedTexSubImage2D. Works on Intel HD 4000
// and Intel HD 5000/Iris that I tested.
// Bug 1124996: Appears to be the same on OSX Yosemite (10.10)
if (nsCocoaFeatures::OSXVersionMajor() == 10 &&
nsCocoaFeatures::OSXVersionMinor() >= 9 &&
if (nsCocoaFeatures::macOSVersionMajor() == 10 &&
nsCocoaFeatures::macOSVersionMinor() >= 9 &&
Renderer() == GLRenderer::IntelHD3000)
{
MarkExtensionUnsupported(EXT_texture_compression_s3tc);
Expand Down
2 changes: 1 addition & 1 deletion media/webrtc/trunk/build/mac/find_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
sdk_dir = xcode43_sdk_path
else:
sdk_dir = os.path.join(out.rstrip(), 'SDKs')
sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
sdks = [re.findall('^MacOSX(\d+\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6']
sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6']
if parse_version(s) >= parse_version(min_sdk_version)]
Expand Down
4 changes: 2 additions & 2 deletions netwerk/protocol/http/nsHttpHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,8 +1047,8 @@ nsHttpHandler::InitUserAgentComponents()
#elif defined(__i386__) || defined(__x86_64__)
mOscpu.AssignLiteral("Intel Mac OS X");
#endif
SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
mOscpu += nsPrintfCString(" %d.%d", static_cast<int>(majorVersion),
static_cast<int>(minorVersion));
#elif defined (XP_UNIX)
Expand Down
2 changes: 1 addition & 1 deletion toolkit/xre/nsNativeAppSupportCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
// alert here. But the alert's message and buttons would require custom
// localization. So (for now at least) we just log an English message
// to the console before quitting.
if (major < 10 || minor < 6) {
if (major < 10 || (major == 10 && minor < 7)) {
NSLog(@"Minimum OS version requirement not met!");
return NS_OK;
}
Expand Down
7 changes: 7 additions & 0 deletions widget/GfxDriverInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ enum class OperatingSystem {
OSX10_10,
OSX10_11,
OSX10_12,
OSX10_13,
OSX10_14,
OSX10_15,
OSX10_16,
OSX11_0,
OSX12_0,
OSX13_0,
Android,
Ios
};
Expand Down
12 changes: 12 additions & 0 deletions widget/GfxInfoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ BlacklistOSToOperatingSystem(const nsAString& os)
return OperatingSystem::OSX10_11;
else if (os.EqualsLiteral("Darwin 16"))
return OperatingSystem::OSX10_12;
else if (os.EqualsLiteral("Darwin 17"))
return OperatingSystem::OSX10_13;
else if (os.EqualsLiteral("Darwin 18"))
return OperatingSystem::OSX10_14;
else if (os.EqualsLiteral("Darwin 19"))
return OperatingSystem::OSX10_15;
else if (os.EqualsLiteral("Darwin 20"))
return OperatingSystem::OSX11_0;
else if (os.EqualsLiteral("Darwin 21"))
return OperatingSystem::OSX12_0;
else if (os.EqualsLiteral("Darwin 22"))
return OperatingSystem::OSX13_0;
else if (os.EqualsLiteral("Android"))
return OperatingSystem::Android;
// For historical reasons, "All" in blocklist means "All Windows"
Expand Down
59 changes: 41 additions & 18 deletions widget/cocoa/GfxInfo.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,50 @@
static OperatingSystem
OSXVersionToOperatingSystem(uint32_t aOSXVersion)
{
if (nsCocoaFeatures::ExtractMajorVersion(aOSXVersion) == 10) {
switch (nsCocoaFeatures::ExtractMinorVersion(aOSXVersion)) {
case 6:
return OperatingSystem::OSX10_6;
case 7:
return OperatingSystem::OSX10_7;
case 8:
return OperatingSystem::OSX10_8;
case 9:
return OperatingSystem::OSX10_9;
case 10:
return OperatingSystem::OSX10_10;
case 11:
return OperatingSystem::OSX10_11;
case 12:
return OperatingSystem::OSX10_12;
}
switch (nsCocoaFeatures::ExtractMajorVersion(aOSXVersion)) {
case 10:
switch (nsCocoaFeatures::ExtractMinorVersion(aOSXVersion)) {
case 6:
return OperatingSystem::OSX10_6;
case 7:
return OperatingSystem::OSX10_7;
case 8:
return OperatingSystem::OSX10_8;
case 9:
return OperatingSystem::OSX10_9;
case 10:
return OperatingSystem::OSX10_10;
case 11:
return OperatingSystem::OSX10_11;
case 12:
return OperatingSystem::OSX10_12;
case 13:
return OperatingSystem::OSX10_13;
case 14:
return OperatingSystem::OSX10_14;
case 15:
return OperatingSystem::OSX10_15;
case 16:
// Depending on the SDK version, we either get 10.16 or 11.0.
// Normalize this to 11.0.
return OperatingSystem::OSX11_0;
default:
break;
}
break;
case 11:
return OperatingSystem::OSX11_0;
case 12:
return OperatingSystem::OSX12_0;
case 13:
return OperatingSystem::OSX13_0;
default:
break;
}

return OperatingSystem::Unknown;
}

// The following three functions are derived from Chromium code
static CFTypeRef SearchPortForProperty(io_registry_entry_t dspPort,
CFStringRef propertyName)
Expand Down Expand Up @@ -113,7 +136,7 @@ static uint32_t IntValueOfCFData(CFDataRef d)

AddCrashReportAnnotations();

mOSXVersion = nsCocoaFeatures::OSXVersion();
mOSXVersion = nsCocoaFeatures::macOSVersion();

return rv;
}
Expand Down
6 changes: 3 additions & 3 deletions widget/cocoa/nsAppShell.mm
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,9 @@ - (void)beginMenuTracking:(NSNotification*)aNotification;
// The bug that this works around was introduced in OS X 10.10.0
// and fixed in OS X 10.10.2. Order these version checks so as
// few as possible will actually end up running.
if (nsCocoaFeatures::OSXVersionMinor() == 10 &&
nsCocoaFeatures::OSXVersionBugFix() < 2 &&
nsCocoaFeatures::OSXVersionMajor() == 10) {
if (nsCocoaFeatures::macOSVersionMinor() == 10 &&
nsCocoaFeatures::macOSVersionBugFix() < 2 &&
nsCocoaFeatures::macOSVersionMajor() == 10) {
// Explicitly turn off CGEvent logging. This works around bug 1092855.
// If there are already CGEvents in the log, turning off logging also
// causes those events to be written to disk. But at this point no
Expand Down
17 changes: 12 additions & 5 deletions widget/cocoa/nsCocoaFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@
/// is the only call that returns the unadjusted values.
class nsCocoaFeatures {
public:
static int32_t OSXVersion();
static int32_t OSXVersionMajor();
static int32_t OSXVersionMinor();
static int32_t OSXVersionBugFix();
static int32_t macOSVersion();
static int32_t macOSVersionMajor();
static int32_t macOSVersionMinor();
static int32_t macOSVersionBugFix();
static bool OnYosemiteOrLater();
static bool OnElCapitanOrLater();
static bool OnSierraOrLater();
static bool OnHighSierraOrLater();
static bool OnMojaveOrLater();
static bool OnCatalinaOrLater();
static bool OnBigSurOrLater();
static bool OnMontereyOrLater();
static bool OnVenturaOrLater();

static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);

static bool ProcessIsRosettaTranslated();

// These are utilities that do not change or depend on the value of mOSXVersion
// and instead just encapsulate the encoding algorithm. Note that GetVersion
// actually adjusts to the lowest supported OS, so it will always return
Expand All @@ -38,7 +45,7 @@ class nsCocoaFeatures {
private:
static void InitializeVersionNumbers();

static int32_t mOSXVersion;
static int32_t mOSVersion;
};

// C-callable helper for cairo-quartz-font.c
Expand Down
Loading

0 comments on commit 6c21719

Please sign in to comment.