From 8c0847db86111566a43ae04bf96c8d18efabb3a2 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Wed, 16 Aug 2023 03:16:44 -0700 Subject: [PATCH] Guard `JSGlobalContextSetInspectable` behind a compile time check --- packages/react-native/ReactCommon/jsc/JSCRuntime.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp index 90a11df160a106..b5616867b6a9c8 100644 --- a/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp +++ b/packages/react-native/ReactCommon/jsc/JSCRuntime.cpp @@ -302,6 +302,9 @@ class JSCRuntime : public jsi::Runtime { #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0 #define _JSC_NO_ARRAY_BUFFERS #endif +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 164000 +#define _JSC_HAS_INSPECTABLE +#endif #endif #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11 @@ -399,7 +402,8 @@ JSCRuntime::JSCRuntime(JSGlobalContextRef ctx) #endif { #ifndef NDEBUG -#ifdef TARGET_OS_MAC +ifdef _JSC_HAS_INSPECTABLE +#if defined(_JSC_HAS_INSPECTABLE) if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) { JSGlobalContextSetInspectable(ctx_, true); }