Summary:
D38460203 (e6ef0836c1) was reverted because it broke OSS, the root cause is that OSS doesn't have MapBuffer module.

Fixed the issue in this diff by moving MapBuffer usage to fb internal class (FBReactModule) and will re-land.

Changelog:
[iOS][Changed] Replace Folly with MapBuffer for passing js error data

Reviewed By: sammy-SC

Differential Revision: D39210957

fbshipit-source-id: dda0e8c55dbd13bc96310e10a3b09ea53978e8bc
This commit is contained in:
Lulu Wu 2022-09-07 14:41:45 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 47a05bc26a
Коммит b6bf1fd373
3 изменённых файлов: 12 добавлений и 14 удалений

Просмотреть файл

@ -1,5 +1,5 @@
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_objc_arc_preprocessor_flags", "get_preprocessor_flags_for_build_mode") load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_objc_arc_preprocessor_flags", "get_preprocessor_flags_for_build_mode")
load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "rn_apple_library", "rn_extra_build_flags") load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_target", "rn_apple_library", "rn_extra_build_flags")
load( load(
"@fbsource//xplat/configurations/buck/apple/plugins/sad_xplat_hosted_configurations:react_module_registration.bzl", "@fbsource//xplat/configurations/buck/apple/plugins/sad_xplat_hosted_configurations:react_module_registration.bzl",
"react_module_plugin_providers", "react_module_plugin_providers",
@ -129,6 +129,9 @@ rn_apple_library(
], ],
reexport_all_header_dependencies = True, reexport_all_header_dependencies = True,
visibility = ["PUBLIC"], visibility = ["PUBLIC"],
deps = [
react_native_xplat_target("react/renderer/mapbuffer:mapbufferApple"),
],
exported_deps = [ exported_deps = [
"//xplat/js/react-native-github:FBReactNativeSpecApple", "//xplat/js/react-native-github:FBReactNativeSpecApple",
"//xplat/js/react-native-github:RCTLinkingApple", "//xplat/js/react-native-github:RCTLinkingApple",

Просмотреть файл

@ -38,7 +38,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)reportFatalException:(nullable NSString *)message - (void)reportFatalException:(nullable NSString *)message
stack:(nullable NSArray<NSDictionary *> *)stack stack:(nullable NSArray<NSDictionary *> *)stack
exceptionId:(double)exceptionId; exceptionId:(double)exceptionId;
- (void)reportJsException:(NSString *)errorMap; - (void)reportJsException:(nullable NSString *)message
stack:(nullable NSArray<NSDictionary *> *)stack
exceptionId:(double)exceptionId
isFatal:(bool)isFatal;
@property (nonatomic, weak) id<RCTExceptionsManagerDelegate> delegate; @property (nonatomic, weak) id<RCTExceptionsManagerDelegate> delegate;

Просмотреть файл

@ -150,19 +150,11 @@ RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData
} }
} }
- (void)reportJsException:(NSString *)errorStr - (void)reportJsException:(nullable NSString *)message
stack:(nullable NSArray<NSDictionary *> *)stack
exceptionId:(double)exceptionId
isFatal:(bool)isFatal
{ {
NSData *jsonData = [errorStr dataUsingEncoding:NSUTF8StringEncoding];
NSError *jsonError;
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONWritingPrettyPrinted
error:&jsonError];
NSString *message = [dict objectForKey:@"message"];
double exceptionId = [[dict objectForKey:@"id"] doubleValue];
NSArray *stack = [dict objectForKey:@"stack"];
BOOL isFatal = [[dict objectForKey:@"isFatal"] boolValue];
if (isFatal) { if (isFatal) {
[self reportFatalException:message stack:stack exceptionId:exceptionId]; [self reportFatalException:message stack:stack exceptionId:exceptionId];
} else { } else {