Bug 1403945: Add utility functions to recognize OS X 10.13. r?mstange draft
authorMilan Sreckovic <milan@mozilla.com>
Thu, 28 Sep 2017 10:21:10 -0400
changeset 671942 855e5cfc1204863abd31ae31cc52d518db67f8af
parent 671801 76a26ef7c493311c170ae83eb0c1d6592a21396d
child 733661 8078c1106e010b2a11d088f9507808b59154f927
push id82091
push userbmo:milan@mozilla.com
push dateThu, 28 Sep 2017 14:21:55 +0000
reviewersmstange
bugs1403945
milestone58.0a1
Bug 1403945: Add utility functions to recognize OS X 10.13. r?mstange MozReview-Commit-ID: Bw0jkyWrIzD
widget/GfxDriverInfo.h
widget/GfxInfoBase.cpp
widget/cocoa/GfxInfo.mm
widget/cocoa/nsCocoaFeatures.h
widget/cocoa/nsCocoaFeatures.mm
--- a/widget/GfxDriverInfo.h
+++ b/widget/GfxDriverInfo.h
@@ -53,16 +53,17 @@ enum class OperatingSystem {
   OSX10_5,
   OSX10_6,
   OSX10_7,
   OSX10_8,
   OSX10_9,
   OSX10_10,
   OSX10_11,
   OSX10_12,
+  OSX10_13,
   Android,
   Ios
 };
 
 enum VersionComparisonOp {
   DRIVER_LESS_THAN,             // driver <  version
   DRIVER_BUILD_ID_LESS_THAN,    // driver build id <  version
   DRIVER_LESS_THAN_OR_EQUAL,    // driver <= version
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -286,16 +286,18 @@ BlacklistOSToOperatingSystem(const nsASt
   else if (os.EqualsLiteral("Darwin 13"))
     return OperatingSystem::OSX10_9;
   else if (os.EqualsLiteral("Darwin 14"))
     return OperatingSystem::OSX10_10;
   else if (os.EqualsLiteral("Darwin 15"))
     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("Android"))
     return OperatingSystem::Android;
   // For historical reasons, "All" in blocklist means "All Windows"
   else if (os.EqualsLiteral("All"))
     return OperatingSystem::Windows;
 
   return OperatingSystem::Unknown;
 }
--- a/widget/cocoa/GfxInfo.mm
+++ b/widget/cocoa/GfxInfo.mm
@@ -49,16 +49,18 @@ OSXVersionToOperatingSystem(uint32_t aOS
       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;
     }
   }
 
   return OperatingSystem::Unknown;
 }
 // The following three functions are derived from Chromium code
 static CFTypeRef SearchPortForProperty(io_registry_entry_t dspPort,
                                        CFStringRef propertyName)
--- a/widget/cocoa/nsCocoaFeatures.h
+++ b/widget/cocoa/nsCocoaFeatures.h
@@ -16,16 +16,17 @@ class nsCocoaFeatures {
 public:
   static int32_t OSXVersion();
   static int32_t OSXVersionMajor();
   static int32_t OSXVersionMinor();
   static int32_t OSXVersionBugFix();
   static bool OnYosemiteOrLater();
   static bool OnElCapitanOrLater();
   static bool OnSierraOrLater();
+  static bool OnHighSierraOrLater();
 
   static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
 
   // 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
   // a "supported" version.  GetSystemVersion does not make any modifications.
   static void GetSystemVersion(int &aMajor, int &aMinor, int &aBugFix);
--- a/widget/cocoa/nsCocoaFeatures.mm
+++ b/widget/cocoa/nsCocoaFeatures.mm
@@ -14,16 +14,17 @@
 #define MAC_OS_X_VERSION_MASK      0x0000FFFF
 #define MAC_OS_X_VERSION_10_0_HEX  0x00001000
 #define MAC_OS_X_VERSION_10_7_HEX  0x00001070
 #define MAC_OS_X_VERSION_10_8_HEX  0x00001080
 #define MAC_OS_X_VERSION_10_9_HEX  0x00001090
 #define MAC_OS_X_VERSION_10_10_HEX 0x000010A0
 #define MAC_OS_X_VERSION_10_11_HEX 0x000010B0
 #define MAC_OS_X_VERSION_10_12_HEX 0x000010C0
+#define MAC_OS_X_VERSION_10_13_HEX 0x000010D0
 
 #include "nsCocoaFeatures.h"
 #include "nsCocoaUtils.h"
 #include "nsDebug.h"
 #include "nsObjCExceptions.h"
 
 #import <Cocoa/Cocoa.h>
 
@@ -162,16 +163,22 @@ nsCocoaFeatures::OnElCapitanOrLater()
 }
 
 /* static */ bool
 nsCocoaFeatures::OnSierraOrLater()
 {
     return (OSXVersion() >= MAC_OS_X_VERSION_10_12_HEX);
 }
 
+/* static */ bool
+nsCocoaFeatures::OnHighSierraOrLater()
+{
+    return (OSXVersion() >= MAC_OS_X_VERSION_10_13_HEX);
+}
+
 /* Version of OnSierraOrLater as a global function callable from C (cairo) */
 bool
 Gecko_OnSierraOrLater()
 {
     return nsCocoaFeatures::OnSierraOrLater();
 }
 
 /* static */ bool