Bug 1284341: Add utility functions to recognize OS X 10.12. r=mstange
authorMilan Sreckovic <milan@mozilla.com>
Mon, 04 Jul 2016 17:25:25 -0400
changeset 334043 1cb27c25505ab4f1e2d9e500e6c4ae9917b34f64
parent 334042 ad03068456bbc9c96e3c04416e462ffdd5cc14be
child 334044 09fbe28859355a4f582f028ea935b8ac33e83182
push idunknown
push userunknown
push dateunknown
reviewersmstange
bugs1284341
milestone50.0a1
Bug 1284341: Add utility functions to recognize OS X 10.12. r=mstange MozReview-Commit-ID: BZOv9lSeWq
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
@@ -52,16 +52,17 @@ enum class OperatingSystem {
   OSX,
   OSX10_5,
   OSX10_6,
   OSX10_7,
   OSX10_8,
   OSX10_9,
   OSX10_10,
   OSX10_11,
+  OSX10_12,
   Android,
   Ios
 };
 
 enum VersionComparisonOp {
   DRIVER_LESS_THAN,             // driver <  version
   DRIVER_LESS_THAN_OR_EQUAL,    // driver <= version
   DRIVER_GREATER_THAN,          // driver >  version
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -269,16 +269,18 @@ BlacklistOSToOperatingSystem(const nsASt
   else if (os.EqualsLiteral("Darwin 12"))
     return OperatingSystem::OSX10_8;
   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("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
@@ -47,16 +47,18 @@ OSXVersionToOperatingSystem(uint32_t aOS
       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;
     }
   }
 
   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
@@ -18,16 +18,17 @@ public:
   static int32_t OSXVersionMajor();
   static int32_t OSXVersionMinor();
   static int32_t OSXVersionBugFix();
   static bool OnLionOrLater();
   static bool OnMountainLionOrLater();
   static bool OnMavericksOrLater();
   static bool OnYosemiteOrLater();
   static bool OnElCapitanOrLater();
+  static bool OnSierraOrLater();
 
   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
@@ -13,16 +13,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
 
 #include "nsCocoaFeatures.h"
 #include "nsCocoaUtils.h"
 #include "nsDebug.h"
 #include "nsObjCExceptions.h"
 
 #import <Cocoa/Cocoa.h>
 
@@ -174,12 +175,18 @@ nsCocoaFeatures::OnYosemiteOrLater()
 
 /* static */ bool
 nsCocoaFeatures::OnElCapitanOrLater()
 {
     return (OSXVersion() >= MAC_OS_X_VERSION_10_11_HEX);
 }
 
 /* static */ bool
+nsCocoaFeatures::OnSierraOrLater()
+{
+    return (OSXVersion() >= MAC_OS_X_VERSION_10_12_HEX);
+}
+
+/* static */ bool
 nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix)
 {
     return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);
 }