Backed out changeset 06fadee788b3 (bug 1616404) for XPCShell failures on OSX in xpcshell/rs-blocklist/test_gfxBlacklist_OK.js. CLOSED TREE

This commit is contained in:
Dorel Luca 2020-05-04 22:46:01 +03:00
Родитель 2e563e1686
Коммит 34f3c60771
8 изменённых файлов: 89 добавлений и 86 удалений

Просмотреть файл

@ -620,8 +620,8 @@ void nsPluginTag::TryUnloadPlugin(bool inShutdown) {
if (PR_GetEnv("MOZ_DISABLE_NPAPI_SANDBOX")) {
// Flash sandbox disabled
sFlashSandboxLevel = 0;
} else if (nsCocoaFeatures::macOSVersionMajor() == 10 &&
nsCocoaFeatures::macOSVersionMinor() <= legacyOSMinorMax) {
} else if (nsCocoaFeatures::OSXVersionMajor() == 10 &&
nsCocoaFeatures::OSXVersionMinor() <= legacyOSMinorMax) {
const char* legacyLevelPref = "dom.ipc.plugins.sandbox-level.flash.legacy";
int32_t compatLevel = Preferences::GetInt(legacyLevelPref, 0);
int32_t level = Preferences::GetInt(levelPref, 0);

Просмотреть файл

@ -711,6 +711,17 @@ bool GLContext::InitImpl() {
MarkUnsupported(GLFeature::framebuffer_multisample);
}
#ifdef XP_MACOSX
// The Mac Nvidia driver, for versions up to and including 10.8,
// don't seem to properly support this. See 814839
// this has been fixed in Mac OS X 10.9. See 907946
// and it also works in 10.8.3 and higher. See 1094338.
if (Vendor() == gl::GLVendor::NVIDIA &&
!nsCocoaFeatures::IsAtLeastVersion(10, 8, 3)) {
MarkUnsupported(GLFeature::depth_texture);
}
#endif
const auto versionStr = (const char*)fGetString(LOCAL_GL_VERSION);
if (strstr(versionStr, "Mesa")) {
// DrawElementsInstanced hangs the driver.

Просмотреть файл

@ -1048,8 +1048,8 @@ void nsHttpHandler::InitUserAgentComponents() {
# elif defined(__i386__) || defined(__x86_64__)
mOscpu.AssignLiteral("Intel Mac OS X");
# endif
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
mOscpu += nsPrintfCString(" %d.%d", static_cast<int>(majorVersion),
static_cast<int>(minorVersion));
# elif defined(XP_UNIX)

Просмотреть файл

@ -102,7 +102,7 @@ nsresult GfxInfo::Init() {
AddCrashReportAnnotations();
mOSXVersion = nsCocoaFeatures::macOSVersion();
mOSXVersion = nsCocoaFeatures::OSXVersion();
return rv;
}

Просмотреть файл

@ -355,8 +355,8 @@ nsresult nsAppShell::Init() {
// 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::macOSVersionMinor() == 10 && nsCocoaFeatures::macOSVersionBugFix() < 2 &&
nsCocoaFeatures::macOSVersionMajor() == 10) {
if (nsCocoaFeatures::OSXVersionMinor() == 10 && nsCocoaFeatures::OSXVersionBugFix() < 2 &&
nsCocoaFeatures::OSXVersionMajor() == 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

Просмотреть файл

@ -14,10 +14,10 @@
/// is the only call that returns the unadjusted values.
class nsCocoaFeatures {
public:
static int32_t macOSVersion();
static int32_t macOSVersionMajor();
static int32_t macOSVersionMinor();
static int32_t macOSVersionBugFix();
static int32_t OSXVersion();
static int32_t OSXVersionMajor();
static int32_t OSXVersionMinor();
static int32_t OSXVersionBugFix();
static bool OnYosemiteOrLater();
static bool OnElCapitanOrLater();
static bool OnSierraExactly();
@ -30,7 +30,7 @@ class nsCocoaFeatures {
int32_t aBugFix = 0);
// These are utilities that do not change or depend on the value of
// mOSVersion and instead just encapsulate the encoding algorithm. Note that
// 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.
@ -41,10 +41,9 @@ class nsCocoaFeatures {
static int32_t ExtractBugFixVersion(int32_t aVersion);
private:
nsCocoaFeatures() = delete; // Prevent instantiation.
static void InitializeVersionNumbers();
static int32_t mOSVersion;
static int32_t mOSXVersion;
};
// C-callable helper for cairo-quartz-font.c and SkFontHost_mac.cpp

Просмотреть файл

@ -3,27 +3,25 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This file makes some assumptions about the versions of macOS.
// We are assuming that the major, minor and bugfix versions are each less than
// 256.
// This file makes some assumptions about the versions of OS X.
// We are assuming that the minor and bugfix versions are less than 16.
// There are MOZ_ASSERTs for that.
// The formula for the version integer is (major << 16) + (minor << 8) + bugfix.
// The formula for the version integer based on OS X version 10.minor.bugfix is
// 0x1000 + (minor << 4) + bugifix. See AssembleVersion() below for major > 10.
// Major version < 10 is not allowed.
#define MACOS_VERSION_MASK 0x00FFFFFF
#define MACOS_MAJOR_VERSION_MASK 0x00FFFFFF
#define MACOS_MINOR_VERSION_MASK 0x00FFFFFF
#define MACOS_BUGFIX_VERSION_MASK 0x00FFFFFF
#define MACOS_VERSION_10_0_HEX 0x000A0000
#define MACOS_VERSION_10_9_HEX 0x000A0900
#define MACOS_VERSION_10_10_HEX 0x000A0A00
#define MACOS_VERSION_10_11_HEX 0x000A0B00
#define MACOS_VERSION_10_12_HEX 0x000A0C00
#define MACOS_VERSION_10_13_HEX 0x000A0D00
#define MACOS_VERSION_10_14_HEX 0x000A0E00
#define MACOS_VERSION_10_15_HEX 0x000A0F00
//#define MACOS_VERSION_10_16_HEX 0x000A1000
//#define MACOS_VERSION_11_0_HEX 0x000B0000
#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
#define MAC_OS_X_VERSION_10_14_HEX 0x000010E0
#define MAC_OS_X_VERSION_10_15_HEX 0x000010F0
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@ -32,27 +30,27 @@
#import <Cocoa/Cocoa.h>
/*static*/ int32_t nsCocoaFeatures::mOSVersion = 0;
int32_t nsCocoaFeatures::mOSXVersion = 0;
// This should not be called with unchecked aMajor, which should be >= 10.
inline int32_t AssembleVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix) {
MOZ_ASSERT(aMajor >= 10);
return (aMajor << 16) + (aMinor << 8) + aBugFix;
return MAC_OS_X_VERSION_10_0_HEX + (aMajor - 10) * 0x100 + (aMinor << 4) + aBugFix;
}
int32_t nsCocoaFeatures::ExtractMajorVersion(int32_t aVersion) {
MOZ_ASSERT((aVersion & MACOS_VERSION_MASK) == aVersion);
return (aVersion & 0xFF0000) >> 16;
MOZ_ASSERT((aVersion & MAC_OS_X_VERSION_MASK) == aVersion);
return ((aVersion & 0xFF00) - 0x1000) / 0x100 + 10;
}
int32_t nsCocoaFeatures::ExtractMinorVersion(int32_t aVersion) {
MOZ_ASSERT((aVersion & MACOS_VERSION_MASK) == aVersion);
return (aVersion & 0xFF00) >> 8;
MOZ_ASSERT((aVersion & MAC_OS_X_VERSION_MASK) == aVersion);
return (aVersion & 0xF0) >> 4;
}
int32_t nsCocoaFeatures::ExtractBugFixVersion(int32_t aVersion) {
MOZ_ASSERT((aVersion & MACOS_VERSION_MASK) == aVersion);
return aVersion & 0xFF;
MOZ_ASSERT((aVersion & MAC_OS_X_VERSION_MASK) == aVersion);
return aVersion & 0x0F;
}
static int intAtStringIndex(NSArray* array, int index) {
@ -65,11 +63,6 @@ void nsCocoaFeatures::GetSystemVersion(int& major, int& minor, int& bugfix) {
NSString* versionString = [[NSDictionary
dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]
objectForKey:@"ProductVersion"];
if (!versionString) {
NS_ERROR("Couldn't read /System/Library/CoreServices/SystemVersion.plist to determine macOS "
"version.");
return;
}
NSArray* versions = [versionString componentsSeparatedByString:@"."];
NSUInteger count = [versions count];
if (count > 0) {
@ -84,28 +77,26 @@ void nsCocoaFeatures::GetSystemVersion(int& major, int& minor, int& bugfix) {
}
int32_t nsCocoaFeatures::GetVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix) {
int32_t macOSVersion;
int32_t osxVersion;
if (aMajor < 10) {
aMajor = 10;
NS_ERROR("Couldn't determine macOS version, assuming 10.9");
macOSVersion = MACOS_VERSION_10_9_HEX;
} else if (aMajor == 10 && aMinor < 9) {
aMinor = 9;
NS_ERROR("macOS version too old, assuming 10.9");
macOSVersion = MACOS_VERSION_10_9_HEX;
NS_ERROR("Couldn't determine OS X version, assuming 10.7");
osxVersion = MAC_OS_X_VERSION_10_7_HEX;
} else if (aMinor < 7) {
aMinor = 7;
NS_ERROR("OS X version too old, assuming 10.7");
osxVersion = MAC_OS_X_VERSION_10_7_HEX;
} else {
MOZ_ASSERT(aMajor >= 10);
MOZ_ASSERT(aMajor < 256);
MOZ_ASSERT(aMinor >= 0);
MOZ_ASSERT(aMinor < 256);
MOZ_ASSERT(aMajor == 10); // For now, even though we're ready...
MOZ_ASSERT(aMinor < 16);
MOZ_ASSERT(aBugFix >= 0);
MOZ_ASSERT(aBugFix < 256);
macOSVersion = AssembleVersion(aMajor, aMinor, aBugFix);
MOZ_ASSERT(aBugFix < 16);
osxVersion = AssembleVersion(aMajor, aMinor, aBugFix);
}
MOZ_ASSERT(aMajor == ExtractMajorVersion(macOSVersion));
MOZ_ASSERT(aMinor == ExtractMinorVersion(macOSVersion));
MOZ_ASSERT(aBugFix == ExtractBugFixVersion(macOSVersion));
return macOSVersion;
MOZ_ASSERT(aMajor == ExtractMajorVersion(osxVersion));
MOZ_ASSERT(aMinor == ExtractMinorVersion(osxVersion));
MOZ_ASSERT(aBugFix == ExtractBugFixVersion(osxVersion));
return osxVersion;
}
/*static*/ void nsCocoaFeatures::InitializeVersionNumbers() {
@ -117,67 +108,69 @@ int32_t nsCocoaFeatures::GetVersion(int32_t aMajor, int32_t aMinor, int32_t aBug
int major, minor, bugfix;
GetSystemVersion(major, minor, bugfix);
mOSVersion = GetVersion(major, minor, bugfix);
mOSXVersion = GetVersion(major, minor, bugfix);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
/* static */ int32_t nsCocoaFeatures::macOSVersion() {
/* static */ int32_t nsCocoaFeatures::OSXVersion() {
// Don't let this be called while we're first setting the value...
MOZ_ASSERT((mOSVersion & MACOS_VERSION_MASK) >= 0);
if (!mOSVersion) {
mOSVersion = -1;
MOZ_ASSERT((mOSXVersion & MAC_OS_X_VERSION_MASK) >= 0);
if (!mOSXVersion) {
mOSXVersion = -1;
InitializeVersionNumbers();
}
return mOSVersion;
return mOSXVersion;
}
/* static */ int32_t nsCocoaFeatures::macOSVersionMajor() {
return ExtractMajorVersion(macOSVersion());
/* static */ int32_t nsCocoaFeatures::OSXVersionMajor() {
MOZ_ASSERT((OSXVersion() & MAC_OS_X_VERSION_10_0_HEX) == MAC_OS_X_VERSION_10_0_HEX);
return 10;
}
/* static */ int32_t nsCocoaFeatures::macOSVersionMinor() {
return ExtractMinorVersion(macOSVersion());
/* static */ int32_t nsCocoaFeatures::OSXVersionMinor() {
return ExtractMinorVersion(OSXVersion());
}
/* static */ int32_t nsCocoaFeatures::macOSVersionBugFix() {
return ExtractBugFixVersion(macOSVersion());
/* static */ int32_t nsCocoaFeatures::OSXVersionBugFix() {
return ExtractBugFixVersion(OSXVersion());
}
/* static */ bool nsCocoaFeatures::OnYosemiteOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_10_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_10_HEX);
}
/* static */ bool nsCocoaFeatures::OnElCapitanOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_11_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_11_HEX);
}
/* static */ bool nsCocoaFeatures::OnSierraExactly() {
return (macOSVersion() >= MACOS_VERSION_10_12_HEX) && (macOSVersion() < MACOS_VERSION_10_13_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_12_HEX) &&
(OSXVersion() < MAC_OS_X_VERSION_10_13_HEX);
}
/* Version of OnSierraExactly as global function callable from cairo & skia */
bool Gecko_OnSierraExactly() { return nsCocoaFeatures::OnSierraExactly(); }
/* static */ bool nsCocoaFeatures::OnSierraOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_12_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_12_HEX);
}
/* static */ bool nsCocoaFeatures::OnHighSierraOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_13_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_13_HEX);
}
bool Gecko_OnHighSierraOrLater() { return nsCocoaFeatures::OnHighSierraOrLater(); }
/* static */ bool nsCocoaFeatures::OnMojaveOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_14_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_14_HEX);
}
/* static */ bool nsCocoaFeatures::OnCatalinaOrLater() {
return (macOSVersion() >= MACOS_VERSION_10_15_HEX);
return (OSXVersion() >= MAC_OS_X_VERSION_10_15_HEX);
}
/* static */ bool nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix) {
return macOSVersion() >= GetVersion(aMajor, aMinor, aBugFix);
return OSXVersion() >= GetVersion(aMajor, aMinor, aBugFix);
}

Просмотреть файл

@ -463,8 +463,8 @@ void ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
}
# pragma warning(pop)
#elif defined(MOZ_WIDGET_COCOA)
SInt32 majorVersion = nsCocoaFeatures::macOSVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::macOSVersionMinor();
SInt32 majorVersion = nsCocoaFeatures::OSXVersionMajor();
SInt32 minorVersion = nsCocoaFeatures::OSXVersionMinor();
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", majorVersion, minorVersion);
#elif defined(MOZ_WIDGET_GTK)
nsTextFormatter::ssprintf(osVersion, u"%ld.%ld", gtk_major_version,