chore: combine some smaller MAS patches (#33595)
* chore: combine some smaller MAS patches * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
parent
4615fc53ca
commit
f95e565884
8 changed files with 234 additions and 272 deletions
|
@ -21,15 +21,11 @@ resource_file_conflict.patch
|
||||||
scroll_bounce_flag.patch
|
scroll_bounce_flag.patch
|
||||||
mas_blink_no_private_api.patch
|
mas_blink_no_private_api.patch
|
||||||
mas_no_private_api.patch
|
mas_no_private_api.patch
|
||||||
mas-cfisobjc.patch
|
|
||||||
mas-cgdisplayusesforcetogray.patch
|
mas-cgdisplayusesforcetogray.patch
|
||||||
mas-audiodeviceduck.patch
|
|
||||||
mas_disable_remote_layer.patch
|
mas_disable_remote_layer.patch
|
||||||
mas_disable_remote_accessibility.patch
|
mas_disable_remote_accessibility.patch
|
||||||
mas_disable_custom_window_frame.patch
|
mas_disable_custom_window_frame.patch
|
||||||
mas_avoid_usage_of_abort_report_np.patch
|
mas_avoid_usage_of_private_macos_apis.patch
|
||||||
mas_avoid_usage_of_pthread_fchdir_np.patch
|
|
||||||
mas_avoid_usage_of_setapplicationisdaemon_and.patch
|
|
||||||
mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
|
mas_use_public_apis_to_determine_if_a_font_is_a_system_font.patch
|
||||||
chrome_key_systems.patch
|
chrome_key_systems.patch
|
||||||
add_didinstallconditionalfeatures.patch
|
add_didinstallconditionalfeatures.patch
|
||||||
|
@ -103,7 +99,6 @@ chore_do_not_use_chrome_windows_in_cryptotoken_webrequestsender.patch
|
||||||
process_singleton.patch
|
process_singleton.patch
|
||||||
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
fix_expose_decrementcapturercount_in_web_contents_impl.patch
|
||||||
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
|
add_ui_scopedcliboardwriter_writeunsaferawdata.patch
|
||||||
mas_gate_private_enterprise_APIs.patch
|
|
||||||
load_v8_snapshot_in_browser_process.patch
|
load_v8_snapshot_in_browser_process.patch
|
||||||
fix_patch_out_permissions_checks_in_exclusive_access.patch
|
fix_patch_out_permissions_checks_in_exclusive_access.patch
|
||||||
fix_aspect_ratio_with_max_size.patch
|
fix_aspect_ratio_with_max_size.patch
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
|
||||||
Date: Thu, 20 Sep 2018 17:49:31 -0700
|
|
||||||
Subject: mas: avoid usage of AudioDeviceDuck
|
|
||||||
|
|
||||||
Removes usage of the AudioDeviceDuck private API.
|
|
||||||
|
|
||||||
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
|
|
||||||
index e28d37435da00153e34132f49ce8f6b240e70a65..77ce459d969022b7c5a4d1e57bb1f7e6fa7a9898 100644
|
|
||||||
--- a/media/audio/mac/audio_low_latency_input_mac.cc
|
|
||||||
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
|
|
||||||
@@ -34,19 +34,23 @@
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
extern "C" {
|
|
||||||
+#ifndef MAS_BUILD
|
|
||||||
// See:
|
|
||||||
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
|
|
||||||
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
|
|
||||||
Float32 inDuckedLevel,
|
|
||||||
const AudioTimeStamp* __nullable inStartTime,
|
|
||||||
Float32 inRampDuration) __attribute__((weak_import));
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void UndoDucking(AudioDeviceID output_device_id) {
|
|
||||||
+#ifndef MAS_BUILD
|
|
||||||
if (AudioDeviceDuck != nullptr) {
|
|
||||||
// Ramp the volume back up over half a second.
|
|
||||||
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
|
@ -1,44 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jeremy Apthorp <nornagon@nornagon.net>
|
|
||||||
Date: Thu, 20 Sep 2018 17:49:20 -0700
|
|
||||||
Subject: mas: avoid usage of _CFIsObjC
|
|
||||||
|
|
||||||
Removes usage of the _CFIsObjC private API.
|
|
||||||
|
|
||||||
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
|
||||||
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
|
|
||||||
--- a/base/mac/foundation_util.mm
|
|
||||||
+++ b/base/mac/foundation_util.mm
|
|
||||||
@@ -30,12 +30,6 @@
|
|
||||||
#if !BUILDFLAG(IS_IOS)
|
|
||||||
CFTypeID SecACLGetTypeID();
|
|
||||||
CFTypeID SecTrustedApplicationGetTypeID();
|
|
||||||
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
|
|
||||||
-// http://www.openradar.me/15341349 rdar://15341349
|
|
||||||
-//
|
|
||||||
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
|
|
||||||
-// minimum OS for Chromium, remove this SPI declaration.
|
|
||||||
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
|
|
||||||
#endif
|
|
||||||
} // extern "C"
|
|
||||||
|
|
||||||
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
|
|
||||||
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
|
|
||||||
DCHECK(!cf_val ||
|
|
||||||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
|
|
||||||
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
|
|
||||||
- [ns_val isKindOfClass:[NSFont class]]));
|
|
||||||
+ ([ns_val isKindOfClass:[NSFont class]]));
|
|
||||||
return ns_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
|
|
||||||
return (CTFontRef)(cf_val);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
|
|
||||||
- return NULL;
|
|
||||||
-
|
|
||||||
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
|
|
||||||
if ([ns_val isKindOfClass:[NSFont class]]) {
|
|
||||||
return (CTFontRef)(cf_val);
|
|
|
@ -1,35 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Samuel Attard <sattard@slack-corp.com>
|
|
||||||
Date: Mon, 4 Mar 2019 14:43:36 -0800
|
|
||||||
Subject: mas: avoid usage of abort_report_np
|
|
||||||
|
|
||||||
Disable usage of the private API abort_report_np in MAS builds.
|
|
||||||
|
|
||||||
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
|
||||||
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
|
|
||||||
--- a/sandbox/mac/sandbox_logging.cc
|
|
||||||
+++ b/sandbox/mac/sandbox_logging.cc
|
|
||||||
@@ -32,9 +32,11 @@
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+#if !defined(MAS_BUILD)
|
|
||||||
extern "C" {
|
|
||||||
void abort_report_np(const char*, ...);
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
namespace sandbox {
|
|
||||||
|
|
||||||
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
|
|
||||||
asl_set(asl_message.get(), ASL_KEY_MSG, message);
|
|
||||||
asl_send(asl_client.get(), asl_message.get());
|
|
||||||
|
|
||||||
+#if !defined(MAS_BUILD)
|
|
||||||
if (level == Level::FATAL) {
|
|
||||||
abort_report_np(message);
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// |error| is strerror(errno) when a P* logging function is called. Pass
|
|
233
patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
Normal file
233
patches/chromium/mas_avoid_usage_of_private_macos_apis.patch
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Samuel Attard <sattard@slack-corp.com>
|
||||||
|
Date: Mon, 4 Mar 2019 14:43:36 -0800
|
||||||
|
Subject: mas: avoid usage of private macOS APIs
|
||||||
|
|
||||||
|
Disable usage of the following private APIs in MAS builds:
|
||||||
|
* abort_report_np
|
||||||
|
* pthread_fchdir_np
|
||||||
|
* pthread_chdir_np
|
||||||
|
* SetApplicationIsDaemon
|
||||||
|
* _LSSetApplicationLaunchServicesServerConnectionStatus
|
||||||
|
* AreDeviceAndUserJoinedToDomain
|
||||||
|
* _CFIsObjC
|
||||||
|
* AudioDeviceDuck
|
||||||
|
|
||||||
|
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
||||||
|
index bbb851e1cafb37ebaa67e4577598fab25c90fde6..6ab12e5505b5ba545e7e0cc8c93d3ba9a6d0bacc 100644
|
||||||
|
--- a/base/enterprise_util_mac.mm
|
||||||
|
+++ b/base/enterprise_util_mac.mm
|
||||||
|
@@ -168,6 +168,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
|
||||||
|
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||||
|
static DeviceUserDomainJoinState state = [] {
|
||||||
|
DeviceUserDomainJoinState state{false, false};
|
||||||
|
+#if defined(MAS_BUILD)
|
||||||
|
+ return state;
|
||||||
|
+ }();
|
||||||
|
+
|
||||||
|
+ return state;
|
||||||
|
+}
|
||||||
|
+#else
|
||||||
|
|
||||||
|
@autoreleasepool {
|
||||||
|
ODSession* session = [ODSession defaultSession];
|
||||||
|
@@ -274,5 +281,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
} // namespace base
|
||||||
|
diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
|
||||||
|
index 61641e1ad8a47a4910918ff61523a23854745b81..d4a3e2282256f5a43235b40b4c9f46caa725c507 100644
|
||||||
|
--- a/base/mac/foundation_util.mm
|
||||||
|
+++ b/base/mac/foundation_util.mm
|
||||||
|
@@ -30,12 +30,6 @@
|
||||||
|
#if !BUILDFLAG(IS_IOS)
|
||||||
|
CFTypeID SecACLGetTypeID();
|
||||||
|
CFTypeID SecTrustedApplicationGetTypeID();
|
||||||
|
-// The NSFont/CTFont toll-free bridging is broken before 10.15.
|
||||||
|
-// http://www.openradar.me/15341349 rdar://15341349
|
||||||
|
-//
|
||||||
|
-// TODO(https://crbug.com/1076527): This is fixed in 10.15. When 10.15 is the
|
||||||
|
-// minimum OS for Chromium, remove this SPI declaration.
|
||||||
|
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
|
||||||
|
#endif
|
||||||
|
} // extern "C"
|
||||||
|
|
||||||
|
@@ -316,8 +310,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
|
||||||
|
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
|
||||||
|
DCHECK(!cf_val ||
|
||||||
|
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
|
||||||
|
- (_CFIsObjC(CTFontGetTypeID(), cf_val) &&
|
||||||
|
- [ns_val isKindOfClass:[NSFont class]]));
|
||||||
|
+ ([ns_val isKindOfClass:[NSFont class]]));
|
||||||
|
return ns_val;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -388,9 +381,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
|
||||||
|
return (CTFontRef)(cf_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!_CFIsObjC(CTFontGetTypeID(), cf_val))
|
||||||
|
- return NULL;
|
||||||
|
-
|
||||||
|
id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val));
|
||||||
|
if ([ns_val isKindOfClass:[NSFont class]]) {
|
||||||
|
return (CTFontRef)(cf_val);
|
||||||
|
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
||||||
|
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
|
||||||
|
--- a/base/process/launch_mac.cc
|
||||||
|
+++ b/base/process/launch_mac.cc
|
||||||
|
@@ -26,8 +26,10 @@ extern "C" {
|
||||||
|
// descriptor. libpthread only exposes a syscall wrapper starting in
|
||||||
|
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
|
||||||
|
// the syscall is issued directly.
|
||||||
|
+#if !defined(MAS_BUILD)
|
||||||
|
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
|
||||||
|
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
||||||
|
API_AVAILABLE(macosx(10.14));
|
||||||
|
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
|
||||||
|
};
|
||||||
|
|
||||||
|
int ChangeCurrentThreadDirectory(const char* path) {
|
||||||
|
+ #if defined(MAS_BUILD)
|
||||||
|
+ return syscall(SYS___pthread_chdir, path);
|
||||||
|
+ #else
|
||||||
|
if (__builtin_available(macOS 10.12, *)) {
|
||||||
|
return pthread_chdir_np(path);
|
||||||
|
} else {
|
||||||
|
return syscall(SYS___pthread_chdir, path);
|
||||||
|
}
|
||||||
|
+ #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// The recommended way to unset a per-thread cwd is to set a new value to an
|
||||||
|
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
|
||||||
|
int ResetCurrentThreadDirectory() {
|
||||||
|
+ #if defined(MAS_BUILD)
|
||||||
|
+ return syscall(SYS___pthread_fchdir, -1);
|
||||||
|
+ #else
|
||||||
|
if (__builtin_available(macOS 10.12, *)) {
|
||||||
|
return pthread_fchdir_np(-1);
|
||||||
|
} else {
|
||||||
|
return syscall(SYS___pthread_fchdir, -1);
|
||||||
|
}
|
||||||
|
+ #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
struct GetAppOutputOptions {
|
||||||
|
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
||||||
|
file_actions.Inherit(STDERR_FILENO);
|
||||||
|
}
|
||||||
|
|
||||||
|
+#if 0
|
||||||
|
if (options.disclaim_responsibility) {
|
||||||
|
if (__builtin_available(macOS 10.14, *)) {
|
||||||
|
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
std::vector<char*> argv_cstr;
|
||||||
|
argv_cstr.reserve(argv.size() + 1);
|
||||||
|
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||||
|
index e28d37435da00153e34132f49ce8f6b240e70a65..77ce459d969022b7c5a4d1e57bb1f7e6fa7a9898 100644
|
||||||
|
--- a/media/audio/mac/audio_low_latency_input_mac.cc
|
||||||
|
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
|
||||||
|
@@ -34,19 +34,23 @@
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
extern "C" {
|
||||||
|
+#ifndef MAS_BUILD
|
||||||
|
// See:
|
||||||
|
// https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
|
||||||
|
OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
|
||||||
|
Float32 inDuckedLevel,
|
||||||
|
const AudioTimeStamp* __nullable inStartTime,
|
||||||
|
Float32 inRampDuration) __attribute__((weak_import));
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void UndoDucking(AudioDeviceID output_device_id) {
|
||||||
|
+#ifndef MAS_BUILD
|
||||||
|
if (AudioDeviceDuck != nullptr) {
|
||||||
|
// Ramp the volume back up over half a second.
|
||||||
|
AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
diff --git a/sandbox/mac/sandbox_logging.cc b/sandbox/mac/sandbox_logging.cc
|
||||||
|
index 702224dce1871c07b07f6882e46d14fe532d6ed2..797cb6646171486797a5e5fbbb1b187e3a9f81d4 100644
|
||||||
|
--- a/sandbox/mac/sandbox_logging.cc
|
||||||
|
+++ b/sandbox/mac/sandbox_logging.cc
|
||||||
|
@@ -32,9 +32,11 @@
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if !defined(MAS_BUILD)
|
||||||
|
extern "C" {
|
||||||
|
void abort_report_np(const char*, ...);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
namespace sandbox {
|
||||||
|
|
||||||
|
@@ -104,9 +106,11 @@ void SendAslLog(Level level, const char* message) {
|
||||||
|
asl_set(asl_message.get(), ASL_KEY_MSG, message);
|
||||||
|
asl_send(asl_client.get(), asl_message.get());
|
||||||
|
|
||||||
|
+#if !defined(MAS_BUILD)
|
||||||
|
if (level == Level::FATAL) {
|
||||||
|
abort_report_np(message);
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// |error| is strerror(errno) when a P* logging function is called. Pass
|
||||||
|
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
||||||
|
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
|
||||||
|
--- a/sandbox/mac/system_services.cc
|
||||||
|
+++ b/sandbox/mac/system_services.cc
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
|
||||||
|
#include "base/mac/mac_logging.h"
|
||||||
|
|
||||||
|
+#if !defined(MAS_BUILD)
|
||||||
|
extern "C" {
|
||||||
|
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
||||||
|
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||||
|
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
||||||
|
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
|
||||||
|
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
|
||||||
|
} // extern "C"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
namespace sandbox {
|
||||||
|
|
||||||
|
void DisableLaunchServices() {
|
||||||
|
+ #if !defined(MAS_BUILD)
|
||||||
|
// Allow the process to continue without a LaunchServices ASN. The
|
||||||
|
// INIT_Process function in HIServices will abort if it cannot connect to
|
||||||
|
// launchservicesd to get an ASN. By setting this flag, HIServices skips
|
||||||
|
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
|
||||||
|
0, ^bool(CFDictionaryRef options) {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
+ #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableCoreServicesCheckFix() {
|
||||||
|
+#if !defined(MAS_BUILD)
|
||||||
|
if (__builtin_available(macOS 10.15, *)) {
|
||||||
|
_CSCheckFixDisable();
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sandbox
|
|
@ -1,66 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Samuel Attard <sattard@slack-corp.com>
|
|
||||||
Date: Mon, 4 Mar 2019 14:46:48 -0800
|
|
||||||
Subject: mas: avoid usage of pthread_fchdir_np
|
|
||||||
|
|
||||||
Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds.
|
|
||||||
|
|
||||||
diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc
|
|
||||||
index 184cfa25dbc6cfa2a32be3f8d964ea359254f807..c9bfc4d8ca1408206244305d7634dcd51e99377c 100644
|
|
||||||
--- a/base/process/launch_mac.cc
|
|
||||||
+++ b/base/process/launch_mac.cc
|
|
||||||
@@ -26,8 +26,10 @@ extern "C" {
|
|
||||||
// descriptor. libpthread only exposes a syscall wrapper starting in
|
|
||||||
// macOS 10.12, but the system call dates back to macOS 10.5. On older OSes,
|
|
||||||
// the syscall is issued directly.
|
|
||||||
+#if !defined(MAS_BUILD)
|
|
||||||
int pthread_chdir_np(const char* dir) API_AVAILABLE(macosx(10.12));
|
|
||||||
int pthread_fchdir_np(int fd) API_AVAILABLE(macosx(10.12));
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
|
|
||||||
API_AVAILABLE(macosx(10.14));
|
|
||||||
@@ -96,21 +98,29 @@ class PosixSpawnFileActions {
|
|
||||||
};
|
|
||||||
|
|
||||||
int ChangeCurrentThreadDirectory(const char* path) {
|
|
||||||
+ #if defined(MAS_BUILD)
|
|
||||||
+ return syscall(SYS___pthread_chdir, path);
|
|
||||||
+ #else
|
|
||||||
if (__builtin_available(macOS 10.12, *)) {
|
|
||||||
return pthread_chdir_np(path);
|
|
||||||
} else {
|
|
||||||
return syscall(SYS___pthread_chdir, path);
|
|
||||||
}
|
|
||||||
+ #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// The recommended way to unset a per-thread cwd is to set a new value to an
|
|
||||||
// invalid file descriptor, per libpthread-218.1.3/private/private.h.
|
|
||||||
int ResetCurrentThreadDirectory() {
|
|
||||||
+ #if defined(MAS_BUILD)
|
|
||||||
+ return syscall(SYS___pthread_fchdir, -1);
|
|
||||||
+ #else
|
|
||||||
if (__builtin_available(macOS 10.12, *)) {
|
|
||||||
return pthread_fchdir_np(-1);
|
|
||||||
} else {
|
|
||||||
return syscall(SYS___pthread_fchdir, -1);
|
|
||||||
}
|
|
||||||
+ #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
struct GetAppOutputOptions {
|
|
||||||
@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector<std::string>& argv,
|
|
||||||
file_actions.Inherit(STDERR_FILENO);
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if 0
|
|
||||||
if (options.disclaim_responsibility) {
|
|
||||||
if (__builtin_available(macOS 10.14, *)) {
|
|
||||||
DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
std::vector<char*> argv_cstr;
|
|
||||||
argv_cstr.reserve(argv.size() + 1);
|
|
|
@ -1,50 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Samuel Attard <sattard@slack-corp.com>
|
|
||||||
Date: Mon, 4 Mar 2019 14:51:45 -0800
|
|
||||||
Subject: mas: avoid usage of SetApplicationIsDaemon and
|
|
||||||
_LSSetApplicationLaunchServicesServerConnectionStatus
|
|
||||||
|
|
||||||
Disable usage of SetApplicationIsDaemon and
|
|
||||||
_LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds
|
|
||||||
|
|
||||||
diff --git a/sandbox/mac/system_services.cc b/sandbox/mac/system_services.cc
|
|
||||||
index 9f5261425162791668c2d15b7ffba091f831d652..c37f3dc05cb8372c7a6c4caef7a280b6f2f48e98 100644
|
|
||||||
--- a/sandbox/mac/system_services.cc
|
|
||||||
+++ b/sandbox/mac/system_services.cc
|
|
||||||
@@ -9,6 +9,7 @@
|
|
||||||
|
|
||||||
#include "base/mac/mac_logging.h"
|
|
||||||
|
|
||||||
+#if !defined(MAS_BUILD)
|
|
||||||
extern "C" {
|
|
||||||
OSStatus SetApplicationIsDaemon(Boolean isDaemon);
|
|
||||||
void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
|
||||||
@@ -19,10 +20,12 @@ void _LSSetApplicationLaunchServicesServerConnectionStatus(
|
|
||||||
// https://github.com/WebKit/webkit/commit/8da694b0b3febcc262653d01a45e946ce91845ed.
|
|
||||||
void _CSCheckFixDisable() API_AVAILABLE(macosx(10.15));
|
|
||||||
} // extern "C"
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
namespace sandbox {
|
|
||||||
|
|
||||||
void DisableLaunchServices() {
|
|
||||||
+ #if !defined(MAS_BUILD)
|
|
||||||
// Allow the process to continue without a LaunchServices ASN. The
|
|
||||||
// INIT_Process function in HIServices will abort if it cannot connect to
|
|
||||||
// launchservicesd to get an ASN. By setting this flag, HIServices skips
|
|
||||||
@@ -36,12 +39,15 @@ void DisableLaunchServices() {
|
|
||||||
0, ^bool(CFDictionaryRef options) {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
+ #endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisableCoreServicesCheckFix() {
|
|
||||||
+#if !defined(MAS_BUILD)
|
|
||||||
if (__builtin_available(macOS 10.15, *)) {
|
|
||||||
_CSCheckFixDisable();
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sandbox
|
|
|
@ -1,36 +0,0 @@
|
||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: VerteDinde <khammond@slack-corp.com>
|
|
||||||
Date: Tue, 19 Oct 2021 16:56:25 -0700
|
|
||||||
Subject: fix: mas gate private enterprise APIs
|
|
||||||
|
|
||||||
Beginning in Electron 15.2.0, Chromium moved several formerly public
|
|
||||||
APIs into the AreDeviceAndUserJoinedToDomain method. Using these APIs
|
|
||||||
in a MAS build will result in rejection from the Apple Store. This
|
|
||||||
patch gates those APIs to non-MAS builds to comply with Apple
|
|
||||||
Store requirements, and returns the default state for MAS builds.
|
|
||||||
|
|
||||||
diff --git a/base/enterprise_util_mac.mm b/base/enterprise_util_mac.mm
|
|
||||||
index bbb851e1cafb37ebaa67e4577598fab25c90fde6..6ab12e5505b5ba545e7e0cc8c93d3ba9a6d0bacc 100644
|
|
||||||
--- a/base/enterprise_util_mac.mm
|
|
||||||
+++ b/base/enterprise_util_mac.mm
|
|
||||||
@@ -168,6 +168,13 @@ MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew() {
|
|
||||||
DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
|
||||||
static DeviceUserDomainJoinState state = [] {
|
|
||||||
DeviceUserDomainJoinState state{false, false};
|
|
||||||
+#if defined(MAS_BUILD)
|
|
||||||
+ return state;
|
|
||||||
+ }();
|
|
||||||
+
|
|
||||||
+ return state;
|
|
||||||
+}
|
|
||||||
+#else
|
|
||||||
|
|
||||||
@autoreleasepool {
|
|
||||||
ODSession* session = [ODSession defaultSession];
|
|
||||||
@@ -274,5 +281,6 @@ DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain() {
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
} // namespace base
|
|
Loading…
Reference in a new issue