Bug 1403945 - Add utility functions to recognize OS X 10.13. r=mstange, a=sledru
authorMilan Sreckovic <milan@mozilla.com>
Thu, 28 Sep 2017 10:21:10 -0400
changeset 432047 9bd05768af69c88d44b84ffcaa9a2644d9a0a6ec
parent 432046 0460ea0333f964f3ff09093260dc648933f43e67
child 432048 41942dc5a92f1fef3f2f8ec78bafb5d9a87b1951
push id7872
push userryanvm@gmail.com
push dateMon, 02 Oct 2017 15:07:52 +0000
treeherdermozilla-beta@0b50c7250aa6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, sledru
bugs1403945
milestone57.0
Bug 1403945 - Add utility functions to recognize OS X 10.13. r=mstange, a=sledru 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