diff --git a/React/Executors/RCTJSCWrapper.h b/React/Executors/RCTJSCWrapper.h index 8a30806c1..8c4ef426e 100644 --- a/React/Executors/RCTJSCWrapper.h +++ b/React/Executors/RCTJSCWrapper.h @@ -9,22 +9,30 @@ #import -#import "RCTDefines.h" +#import typedef void (*voidWithNoParamsFuncType)(); typedef JSStringRef (*JSStringCreateWithCFStringFuncType)(CFStringRef); typedef JSStringRef (*JSStringCreateWithUTF8CStringFuncType)(const char *); +typedef CFStringRef (*JSStringCopyCFStringFuncType)(CFAllocatorRef, JSStringRef); typedef void (*JSStringReleaseFuncType)(JSStringRef); typedef void (*JSGlobalContextSetNameFuncType)(JSGlobalContextRef, JSStringRef); typedef void (*JSObjectSetPropertyFuncType)(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSPropertyAttributes, JSValueRef *); typedef JSObjectRef (*JSContextGetGlobalObjectFuncType)(JSContextRef); typedef JSValueRef (*JSObjectGetPropertyFuncType)(JSContextRef, JSObjectRef, JSStringRef, JSValueRef *); +typedef bool (*JSObjectIsFunctionFuncType)(JSContextRef, JSObjectRef); +typedef bool (*JSObjectIsConstructorFuncType)(JSContextRef, JSObjectRef); +typedef JSPropertyNameArrayRef (*JSObjectCopyPropertyNamesFuncType)(JSContextRef, JSObjectRef); +typedef size_t (*JSPropertyNameArrayGetCountFuncType)(JSPropertyNameArrayRef); +typedef JSStringRef (*JSPropertyNameArrayGetNameAtIndexFuncType)(JSPropertyNameArrayRef, size_t); +typedef void (*JSPropertyNameArrayReleaseFuncType)(JSPropertyNameArrayRef); typedef JSValueRef (*JSValueMakeFromJSONStringFuncType)(JSContextRef, JSStringRef); typedef JSValueRef (*JSObjectCallAsFunctionFuncType)(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef *, JSValueRef *); typedef JSValueRef (*JSValueMakeNullFuncType)(JSContextRef); typedef JSStringRef (*JSValueCreateJSONStringFuncType)(JSContextRef, JSValueRef, unsigned, JSValueRef *); typedef bool (*JSValueIsUndefinedFuncType)(JSContextRef, JSValueRef); typedef bool (*JSValueIsNullFuncType)(JSContextRef, JSValueRef); +typedef JSObjectRef (*JSValueToObjectFuncType)(JSContextRef, JSValueRef, JSValueRef *); typedef JSValueRef (*JSEvaluateScriptFuncType)(JSContextRef, JSStringRef, JSObjectRef, JSStringRef, int, JSValueRef *); typedef JSValueRef (*JSEvaluateBytecodeBundleFuncType)(JSContextRef, JSObjectRef, int, JSStringRef, JSValueRef *); @@ -38,17 +46,25 @@ extern const int32_t JSNoBytecodeFileFormatVersion; typedef struct RCTJSCWrapper { JSStringCreateWithCFStringFuncType JSStringCreateWithCFString; JSStringCreateWithUTF8CStringFuncType JSStringCreateWithUTF8CString; + JSStringCopyCFStringFuncType JSStringCopyCFString; JSStringReleaseFuncType JSStringRelease; JSGlobalContextSetNameFuncType JSGlobalContextSetName; JSObjectSetPropertyFuncType JSObjectSetProperty; JSContextGetGlobalObjectFuncType JSContextGetGlobalObject; JSObjectGetPropertyFuncType JSObjectGetProperty; + JSObjectIsFunctionFuncType JSObjectIsFunction; + JSObjectIsConstructorFuncType JSObjectIsConstructor; + JSObjectCopyPropertyNamesFuncType JSObjectCopyPropertyNames; + JSPropertyNameArrayGetCountFuncType JSPropertyNameArrayGetCount; + JSPropertyNameArrayGetNameAtIndexFuncType JSPropertyNameArrayGetNameAtIndex; + JSPropertyNameArrayReleaseFuncType JSPropertyNameArrayRelease; JSValueMakeFromJSONStringFuncType JSValueMakeFromJSONString; JSObjectCallAsFunctionFuncType JSObjectCallAsFunction; JSValueMakeNullFuncType JSValueMakeNull; JSValueCreateJSONStringFuncType JSValueCreateJSONString; JSValueIsUndefinedFuncType JSValueIsUndefined; JSValueIsNullFuncType JSValueIsNull; + JSValueToObjectFuncType JSValueToObject; JSEvaluateScriptFuncType JSEvaluateScript; JSEvaluateBytecodeBundleFuncType JSEvaluateBytecodeBundle; voidWithNoParamsFuncType configureJSCForIOS; diff --git a/React/Executors/RCTJSCWrapper.mm b/React/Executors/RCTJSCWrapper.mm index 3b13b8e14..d642557b8 100644 --- a/React/Executors/RCTJSCWrapper.mm +++ b/React/Executors/RCTJSCWrapper.mm @@ -62,17 +62,25 @@ static RCTJSCWrapper *RCTSetUpSystemLibraryPointers() return new RCTJSCWrapper { .JSStringCreateWithCFString = JSStringCreateWithCFString, .JSStringCreateWithUTF8CString = JSStringCreateWithUTF8CString, + .JSStringCopyCFString = JSStringCopyCFString, .JSStringRelease = JSStringRelease, .JSGlobalContextSetName = JSGlobalContextSetName, .JSObjectSetProperty = JSObjectSetProperty, .JSContextGetGlobalObject = JSContextGetGlobalObject, .JSObjectGetProperty = JSObjectGetProperty, + .JSObjectIsFunction = JSObjectIsFunction, + .JSObjectIsConstructor = JSObjectIsConstructor, + .JSObjectCopyPropertyNames = JSObjectCopyPropertyNames, + .JSPropertyNameArrayGetCount = JSPropertyNameArrayGetCount, + .JSPropertyNameArrayGetNameAtIndex = JSPropertyNameArrayGetNameAtIndex, + .JSPropertyNameArrayRelease = JSPropertyNameArrayRelease, .JSValueMakeFromJSONString = JSValueMakeFromJSONString, .JSObjectCallAsFunction = JSObjectCallAsFunction, .JSValueMakeNull = JSValueMakeNull, .JSValueCreateJSONString = JSValueCreateJSONString, .JSValueIsUndefined = JSValueIsUndefined, .JSValueIsNull = JSValueIsNull, + .JSValueToObject = JSValueToObject, .JSEvaluateScript = JSEvaluateScript, .JSBytecodeFileFormatVersion = JSNoBytecodeFileFormatVersion, .JSEvaluateBytecodeBundle = (JSEvaluateBytecodeBundleFuncType)UnimplementedJSEvaluateBytecodeBundle, @@ -92,17 +100,25 @@ static RCTJSCWrapper *RCTSetUpCustomLibraryPointers() auto wrapper = new RCTJSCWrapper { .JSStringCreateWithCFString = (JSStringCreateWithCFStringFuncType)dlsym(libraryHandle, "JSStringCreateWithCFString"), .JSStringCreateWithUTF8CString = (JSStringCreateWithUTF8CStringFuncType)dlsym(libraryHandle, "JSStringCreateWithUTF8CString"), + .JSStringCopyCFString = (JSStringCopyCFStringFuncType)dlsym(libraryHandle, "JSStringCopyCFString"), .JSStringRelease = (JSStringReleaseFuncType)dlsym(libraryHandle, "JSStringRelease"), .JSGlobalContextSetName = (JSGlobalContextSetNameFuncType)dlsym(libraryHandle, "JSGlobalContextSetName"), .JSObjectSetProperty = (JSObjectSetPropertyFuncType)dlsym(libraryHandle, "JSObjectSetProperty"), .JSContextGetGlobalObject = (JSContextGetGlobalObjectFuncType)dlsym(libraryHandle, "JSContextGetGlobalObject"), .JSObjectGetProperty = (JSObjectGetPropertyFuncType)dlsym(libraryHandle, "JSObjectGetProperty"), + .JSObjectIsFunction = (JSObjectIsFunctionFuncType)dlsym(libraryHandle, "JSObjectIsFunction"), + .JSObjectIsConstructor = (JSObjectIsConstructorFuncType)dlsym(libraryHandle, "JSObjectIsConstructor"), + .JSObjectCopyPropertyNames = (JSObjectCopyPropertyNamesFuncType)dlsym(libraryHandle, "JSObjectCopyPropertyNames"), + .JSPropertyNameArrayGetCount = (JSPropertyNameArrayGetCountFuncType)dlsym(libraryHandle, "JSPropertyNameArrayGetCount"), + .JSPropertyNameArrayGetNameAtIndex = (JSPropertyNameArrayGetNameAtIndexFuncType)dlsym(libraryHandle, "JSPropertyNameArrayGetNameAtIndex"), + .JSPropertyNameArrayRelease = (JSPropertyNameArrayReleaseFuncType)dlsym(libraryHandle, "JSPropertyNameArrayRelease"), .JSValueMakeFromJSONString = (JSValueMakeFromJSONStringFuncType)dlsym(libraryHandle, "JSValueMakeFromJSONString"), .JSObjectCallAsFunction = (JSObjectCallAsFunctionFuncType)dlsym(libraryHandle, "JSObjectCallAsFunction"), .JSValueMakeNull = (JSValueMakeNullFuncType)dlsym(libraryHandle, "JSValueMakeNull"), .JSValueCreateJSONString = (JSValueCreateJSONStringFuncType)dlsym(libraryHandle, "JSValueCreateJSONString"), .JSValueIsUndefined = (JSValueIsUndefinedFuncType)dlsym(libraryHandle, "JSValueIsUndefined"), .JSValueIsNull = (JSValueIsNullFuncType)dlsym(libraryHandle, "JSValueIsNull"), + .JSValueToObject = (JSValueToObjectFuncType)dlsym(libraryHandle, "JSValueToObject"), .JSEvaluateScript = (JSEvaluateScriptFuncType)dlsym(libraryHandle, "JSEvaluateScript"), .JSEvaluateBytecodeBundle = (JSEvaluateBytecodeBundleFuncType)dlsym(libraryHandle, "JSEvaluateBytecodeBundle"), .configureJSCForIOS = (voidWithNoParamsFuncType)dlsym(libraryHandle, "configureJSCForIOS"),