From 2acd5c0329f0334c7987906012b8d67e06b20bd4 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Thu, 11 May 2023 18:58:13 -0700 Subject: [PATCH] remove jsErrorHandlingFunc from constructor of RCTHost Summary: Changelog: [Internal] after D45720132, we don't need this! bypass-github-export-checks Reviewed By: cipolleschi Differential Revision: D45720130 fbshipit-source-id: dd3d8a5bd95faffefb94264d67dfb785dff50ade --- .../react/bridgeless/platform/ios/Core/RCTHost.h | 1 - .../react/bridgeless/platform/ios/Core/RCTHost.mm | 11 +++-------- .../react/bridgeless/platform/ios/Core/RCTInstance.h | 4 +--- .../react/bridgeless/platform/ios/Core/RCTInstance.mm | 3 --- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h index 29bfeea74e86f0..603e795f1778ed 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.h @@ -61,7 +61,6 @@ typedef std::shared_ptr (^RCTHostJSEngineProv - (instancetype)initWithHostDelegate:(id)hostDelegate turboModuleManagerDelegate:(id)turboModuleManagerDelegate bindingsInstallFunc:(facebook::react::ReactInstance::BindingsInstallFunc)bindingsInstallFunc - jsErrorHandlingFunc:(facebook::react::JsErrorHandler::JsErrorHandlingFunc)jsErrorHandlingFunc jsEngineProvider:(nullable RCTHostJSEngineProvider)jsEngineProvider NS_DESIGNATED_INITIALIZER FB_OBJC_DIRECT; diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm index ea2f4d81eecc6a..7826069b1a7838 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTHost.mm @@ -34,7 +34,6 @@ @implementation RCTHost { NSURL *_bundleURL; RCTBundleManager *_bundleManager; facebook::react::ReactInstance::BindingsInstallFunc _bindingsInstallFunc; - JsErrorHandler::JsErrorHandlingFunc _jsErrorHandlingFunc; RCTHostJSEngineProvider _jsEngineProvider; // All the surfaces that need to be started after main bundle execution @@ -59,7 +58,6 @@ + (void)initialize - (instancetype)initWithHostDelegate:(id)hostDelegate turboModuleManagerDelegate:(id)turboModuleManagerDelegate bindingsInstallFunc:(facebook::react::ReactInstance::BindingsInstallFunc)bindingsInstallFunc - jsErrorHandlingFunc:(JsErrorHandler::JsErrorHandlingFunc)jsErrorHandlingFunc jsEngineProvider:(nullable RCTHostJSEngineProvider)jsEngineProvider { if (self = [super init]) { @@ -69,7 +67,6 @@ - (instancetype)initWithHostDelegate:(id)hostDelegate _bundleManager = [RCTBundleManager new]; _bindingsInstallFunc = bindingsInstallFunc; _moduleRegistry = [RCTModuleRegistry new]; - _jsErrorHandlingFunc = jsErrorHandlingFunc; _jsEngineProvider = [jsEngineProvider copy]; __weak RCTHost *weakHost = self; @@ -159,8 +156,7 @@ - (void)preload turboModuleManagerDelegate:_turboModuleManagerDelegate onInitialBundleLoad:_onInitialBundleLoad bindingsInstallFunc:_bindingsInstallFunc - moduleRegistry:_moduleRegistry - jsErrorHandlingFunc:_jsErrorHandlingFunc]; + moduleRegistry:_moduleRegistry]; } - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName @@ -229,8 +225,7 @@ - (void)didReceiveReloadCommand turboModuleManagerDelegate:_turboModuleManagerDelegate onInitialBundleLoad:_onInitialBundleLoad bindingsInstallFunc:_bindingsInstallFunc - moduleRegistry:_moduleRegistry - jsErrorHandlingFunc:_jsErrorHandlingFunc]; + moduleRegistry:_moduleRegistry]; [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:RCTHostDidReloadNotification object:nil]]; @@ -256,7 +251,7 @@ - (void)instance:(RCTInstance *)instance didReceiveErrorMap:(facebook::react::Ma NSString *message = [NSString stringWithCString:errorMap.getString(JSErrorHandlerKey::kErrorMessage).c_str() encoding:[NSString defaultCStringEncoding]]; std::vector frames = errorMap.getMapBufferList(JSErrorHandlerKey::kAllStackFrames); - NSMutableArray *stack = [NSMutableArray new]; + NSMutableArray *> *stack = [NSMutableArray new]; for (facebook::react::MapBuffer const &mapBuffer : frames) { NSDictionary *frame = @{ @"file" : [NSString stringWithCString:mapBuffer.getString(JSErrorHandlerKey::kFrameFileName).c_str() diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h index 9153f746019779..90ed79d9b117e0 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.h @@ -58,9 +58,7 @@ typedef void (^_Null_unspecified RCTInstanceInitialBundleLoadCompletionBlock)(); turboModuleManagerDelegate:(id)turboModuleManagerDelegate onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad bindingsInstallFunc:(facebook::react::ReactInstance::BindingsInstallFunc)bindingsInstallFunc - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - jsErrorHandlingFunc:(facebook::react::JsErrorHandler::JsErrorHandlingFunc)jsErrorHandlingFunc - FB_OBJC_DIRECT; + moduleRegistry:(RCTModuleRegistry *)moduleRegistry FB_OBJC_DIRECT; - (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args; diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm index 0b9ce6346a190e..5839e202d2b0b7 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm @@ -73,7 +73,6 @@ @implementation RCTInstance { RCTInstanceInitialBundleLoadCompletionBlock _onInitialBundleLoad; ReactInstance::BindingsInstallFunc _bindingsInstallFunc; RCTTurboModuleManager *_turboModuleManager; - JsErrorHandler::JsErrorHandlingFunc _jsErrorHandlingFunc; std::mutex _invalidationMutex; std::atomic _valid; RCTJSThreadManager *_jsThreadManager; @@ -91,7 +90,6 @@ - (instancetype)initWithDelegate:(id)delegate onInitialBundleLoad:(RCTInstanceInitialBundleLoadCompletionBlock)onInitialBundleLoad bindingsInstallFunc:(ReactInstance::BindingsInstallFunc)bindingsInstallFunc moduleRegistry:(RCTModuleRegistry *)moduleRegistry - jsErrorHandlingFunc:(JsErrorHandler::JsErrorHandlingFunc)jsErrorHandlingFunc; { if (self = [super init]) { _performanceLogger = [RCTPerformanceLogger new]; @@ -104,7 +102,6 @@ - (instancetype)initWithDelegate:(id)delegate _jsThreadManager = [RCTJSThreadManager new]; _onInitialBundleLoad = onInitialBundleLoad; _bindingsInstallFunc = bindingsInstallFunc; - _jsErrorHandlingFunc = jsErrorHandlingFunc; _bridgeModuleDecorator = [[RCTBridgeModuleDecorator alloc] initWithViewRegistry:[RCTViewRegistry new] moduleRegistry:moduleRegistry bundleManager:bundleManager