@@ -276,6 +276,9 @@ class JSCRuntime : public jsi::Runtime {
276
276
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0
277
277
#define _JSC_FAST_IS_ARRAY
278
278
#endif
279
+ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
280
+ #define _JSC_NO_ARRAY_BUFFERS
281
+ #endif
279
282
#endif
280
283
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
281
284
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
@@ -284,6 +287,9 @@ class JSCRuntime : public jsi::Runtime {
284
287
// we understand why.
285
288
#define _JSC_FAST_IS_ARRAY
286
289
#endif
290
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12
291
+ #define _JSC_NO_ARRAY_BUFFERS
292
+ #endif
287
293
#endif
288
294
289
295
// JSStringRef utilities
@@ -922,24 +928,30 @@ bool JSCRuntime::isArray(const jsi::Object &obj) const {
922
928
#endif
923
929
}
924
930
925
- bool JSCRuntime::isArrayBuffer (const jsi::Object & /* obj*/ ) const {
926
- // TODO: T23270523 - This would fail on builds that use our custom JSC
927
- // auto typedArrayType = JSValueGetTypedArrayType(ctx_, objectRef(obj),
928
- // nullptr); return typedArrayType == kJSTypedArrayTypeArrayBuffer;
931
+ bool JSCRuntime::isArrayBuffer (const jsi::Object &obj) const {
932
+ #if defined(_JSC_NO_ARRAY_BUFFERS)
929
933
throw std::runtime_error (" Unsupported" );
934
+ #else
935
+ auto typedArrayType = JSValueGetTypedArrayType (ctx_, objectRef (obj), nullptr );
936
+ return typedArrayType == kJSTypedArrayTypeArrayBuffer ;
937
+ #endif
930
938
}
931
939
932
- uint8_t *JSCRuntime::data (const jsi::ArrayBuffer & /* obj*/ ) {
933
- // TODO: T23270523 - This would fail on builds that use our custom JSC
934
- // return static_cast<uint8_t*>(
935
- // JSObjectGetArrayBufferBytesPtr(ctx_, objectRef(obj), nullptr));
940
+ uint8_t *JSCRuntime::data (const jsi::ArrayBuffer &obj) {
941
+ #if defined(_JSC_NO_ARRAY_BUFFERS)
936
942
throw std::runtime_error (" Unsupported" );
943
+ #else
944
+ return static_cast <uint8_t *>(
945
+ JSObjectGetArrayBufferBytesPtr (ctx_, objectRef (obj), nullptr ));
946
+ #endif
937
947
}
938
948
939
- size_t JSCRuntime::size (const jsi::ArrayBuffer & /* obj*/ ) {
940
- // TODO: T23270523 - This would fail on builds that use our custom JSC
941
- // return JSObjectGetArrayBufferByteLength(ctx_, objectRef(obj), nullptr);
949
+ size_t JSCRuntime::size (const jsi::ArrayBuffer &obj) {
950
+ #if defined(_JSC_NO_ARRAY_BUFFERS)
942
951
throw std::runtime_error (" Unsupported" );
952
+ #else
953
+ return JSObjectGetArrayBufferByteLength (ctx_, objectRef (obj), nullptr );
954
+ #endif
943
955
}
944
956
945
957
bool JSCRuntime::isFunction (const jsi::Object &obj) const {
0 commit comments