Bug 970483 - Blackliist pre-RTM Windows 7 again to prevent Firefox from crash. r=bbondy,jfkthame a=lsblakk
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Wed, 12 Feb 2014 06:01:29 +0900
changeset 176314 4a14fddfebe9da8507486d76cf48051861bbbf1a
parent 176313 7e47e1271dd5615d07ae29b7fa512bb211f5a541
child 176315 c515e8ba94f7124e33dd415a903e32e5959b6d77
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, jfkthame, lsblakk
bugs970483
milestone28.0
Bug 970483 - Blackliist pre-RTM Windows 7 again to prevent Firefox from crash. r=bbondy,jfkthame a=lsblakk
gfx/thebes/gfxWindowsPlatform.cpp
xpcom/base/WindowsVersion.h
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -615,17 +615,19 @@ gfxWindowsPlatform::VerifyD2DDevice(bool
 }
 
 gfxPlatformFontList*
 gfxWindowsPlatform::CreatePlatformFontList()
 {
     mUsingGDIFonts = false;
     gfxPlatformFontList *pfl;
 #ifdef CAIRO_HAS_DWRITE_FONT
-    if (GetDWriteFactory()) {
+    // bug 630201 - older pre-RTM versions of Direct2D/DirectWrite cause odd
+    // crashers so blacklist them altogether
+    if (IsNotWin7PreRTM() && GetDWriteFactory()) {
         pfl = new gfxDWriteFontList();
         if (NS_SUCCEEDED(pfl->InitFontList())) {
             return pfl;
         }
         // DWrite font initialization failed! Don't know why this would happen,
         // but apparently it can - see bug 594865.
         // So we're going to fall back to GDI fonts & rendering.
         gfxPlatformFontList::Shutdown();
--- a/xpcom/base/WindowsVersion.h
+++ b/xpcom/base/WindowsVersion.h
@@ -6,36 +6,36 @@
 #define mozilla_WindowsVersion_h
 
 #include "nscore.h"
 #include <windows.h>
 
 namespace mozilla
 {
   inline bool
-  IsWindowsVersionOrLater(uint64_t aVersion)
+  IsWindowsVersionOrLater(uint32_t aVersion)
   {
-    static uint64_t minVersion = 0;
-    static uint64_t maxVersion = UINT64_MAX;
+    static uint32_t minVersion = 0;
+    static uint32_t maxVersion = UINT32_MAX;
 
     if (minVersion >= aVersion) {
       return true;
     }
 
     if (aVersion >= maxVersion) {
       return false;
     }
 
     OSVERSIONINFOEX info;
     ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
     info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-    info.dwMajorVersion = aVersion >> 48;
-    info.dwMinorVersion = (aVersion >> 32) & 0xFFFF;
-    info.wServicePackMajor = (aVersion >> 16) & 0xFFFF;
-    info.wServicePackMinor = aVersion & 0xFFFF;
+    info.dwMajorVersion = aVersion >> 24;
+    info.dwMinorVersion = (aVersion >> 16) & 0xFF;
+    info.wServicePackMajor = (aVersion >> 8) & 0xFF;
+    info.wServicePackMinor = aVersion & 0xFF;
 
     DWORDLONG conditionMask = 0;
     VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
     VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
     VER_SET_CONDITION(conditionMask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
     VER_SET_CONDITION(conditionMask, VER_SERVICEPACKMINOR, VER_GREATER_EQUAL);
 
     if (VerifyVersionInfo(&info,
@@ -45,42 +45,80 @@ namespace mozilla
       minVersion = aVersion;
       return true;
     }
 
     maxVersion = aVersion;
     return false;
   }
 
+  inline bool
+  IsWindowsBuildOrLater(uint32_t aBuild)
+  {
+    static uint32_t minBuild = 0;
+    static uint32_t maxBuild = UINT32_MAX;
+
+    if (minBuild >= aBuild) {
+      return true;
+    }
+
+    if (aBuild >= maxBuild) {
+      return false;
+    }
+
+    OSVERSIONINFOEX info;
+    ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
+    info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+    info.dwBuildNumber = aBuild;
+
+    DWORDLONG conditionMask = 0;
+    VER_SET_CONDITION(conditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
+
+    if (VerifyVersionInfo(&info, VER_BUILDNUMBER, conditionMask)) {
+      minBuild = aBuild;
+      return true;
+    }
+
+    maxBuild = aBuild;
+    return false;
+  }
+
   MOZ_ALWAYS_INLINE bool
   IsXPSP3OrLater()
-  { return IsWindowsVersionOrLater(0x0005000100030000ull); }
+  { return IsWindowsVersionOrLater(0x05010300ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsWin2003OrLater()
-  { return IsWindowsVersionOrLater(0x0005000200000000ull); }
+  { return IsWindowsVersionOrLater(0x05020000ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsWin2003SP2OrLater()
-  { return IsWindowsVersionOrLater(0x0005000200020000ull); }
+  { return IsWindowsVersionOrLater(0x05020200ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsVistaOrLater()
-  { return IsWindowsVersionOrLater(0x0006000000000000ull); }
+  { return IsWindowsVersionOrLater(0x06000000ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsVistaSP1OrLater()
-  { return IsWindowsVersionOrLater(0x0006000000010000ull); }
+  { return IsWindowsVersionOrLater(0x06000100ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsWin7OrLater()
-  { return IsWindowsVersionOrLater(0x0006000100000000ull); }
+  { return IsWindowsVersionOrLater(0x06010000ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsWin7SP1OrLater()
-  { return IsWindowsVersionOrLater(0x0006000100010000ull); }
+  { return IsWindowsVersionOrLater(0x06010100ul); }
 
   MOZ_ALWAYS_INLINE bool
   IsWin8OrLater()
-  { return IsWindowsVersionOrLater(0x0006000200000000ull); }
+  { return IsWindowsVersionOrLater(0x06020000ul); }
+
+  MOZ_ALWAYS_INLINE bool
+  IsNotWin7PreRTM()
+  {
+    return IsWin7SP1OrLater() || !IsWin7OrLater() ||
+           IsWindowsBuildOrLater(7600);
+  }
 }
 
 #endif /* mozilla_WindowsVersion_h */