react-native-windows 0.80.1 → 0.80.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/Directory.Build.props +1 -1
  2. package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.cpp +169 -0
  3. package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.h +42 -0
  4. package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
  5. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +60 -33
  6. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +68 -1
  7. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +9 -0
  8. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -3
  9. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +6 -1
  10. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +14 -1
  11. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +75 -24
  12. package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +4 -25
  13. package/Microsoft.ReactNative/JsiApi.cpp +1 -1
  14. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
  15. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +3 -0
  16. package/Microsoft.ReactNative/ReactHost/DebuggerNotifications.h +54 -0
  17. package/Microsoft.ReactNative/ReactHost/React.h +11 -4
  18. package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +195 -29
  19. package/Microsoft.ReactNative/ReactHost/ReactHost.h +22 -4
  20. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -5
  21. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  22. package/Microsoft.ReactNative/ReactRootView.cpp +108 -0
  23. package/Microsoft.ReactNative/ReactRootView.h +6 -0
  24. package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -1
  25. package/Microsoft.ReactNative.Cxx/JSI/decorator.h +41 -0
  26. package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +16 -0
  27. package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +125 -0
  28. package/Microsoft.ReactNative.Cxx/JSI/jsi.h +167 -1
  29. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +1 -1
  30. package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +110 -38
  31. package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +44 -31
  32. package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +13 -14
  33. package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +19 -4
  34. package/Microsoft.ReactNative.Cxx/node-api/node_api.h +270 -0
  35. package/Microsoft.ReactNative.Cxx/node-api/node_api_types.h +52 -0
  36. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  37. package/PropertySheets/JSEngine.props +1 -1
  38. package/PropertySheets/React.Cpp.props +2 -2
  39. package/ReactCommon/ReactCommon.vcxproj +18 -1
  40. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +1 -1
  41. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +4 -4
  42. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +23 -9
  43. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +16 -0
  44. package/ReactCommon/cgmanifest.json +1 -1
  45. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -0
  46. package/Shared/DevServerHelper.h +13 -3
  47. package/Shared/DevSettings.h +7 -0
  48. package/Shared/DevSupportManager.cpp +79 -20
  49. package/Shared/DevSupportManager.h +7 -19
  50. package/Shared/Hermes/HermesRuntimeAgentDelegate.cpp +99 -0
  51. package/Shared/Hermes/HermesRuntimeAgentDelegate.h +81 -0
  52. package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +263 -0
  53. package/Shared/Hermes/HermesRuntimeTargetDelegate.h +77 -0
  54. package/Shared/HermesRuntimeHolder.cpp +29 -111
  55. package/Shared/HermesRuntimeHolder.h +214 -32
  56. package/Shared/IDevSupportManager.h +5 -2
  57. package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.cpp +108 -0
  58. package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.h +19 -0
  59. package/Shared/Inspector/ReactInspectorThread.h +18 -0
  60. package/Shared/JSI/RuntimeHolder.h +5 -2
  61. package/Shared/OInstance.cpp +44 -27
  62. package/Shared/Shared.vcxitems +27 -17
  63. package/Shared/Shared.vcxitems.filters +33 -15
  64. package/package.json +5 -5
  65. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +0 -78
  66. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -196
  67. package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +0 -429
  68. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.cpp +0 -45
  69. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.h +0 -91
  70. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +0 -670
  71. package/Shared/InspectorPackagerConnection.cpp +0 -232
  72. package/Shared/InspectorPackagerConnection.h +0 -61
  73. /package/Shared/{HermesSamplingProfiler.cpp → Hermes/HermesSamplingProfiler.cpp} +0 -0
  74. /package/Shared/{HermesSamplingProfiler.h → Hermes/HermesSamplingProfiler.h} +0 -0
@@ -4,7 +4,7 @@
4
4
  #ifndef SRC_JS_RUNTIME_API_H_
5
5
  #define SRC_JS_RUNTIME_API_H_
6
6
 
7
- #include "js_native_api.h"
7
+ #include "node_api.h"
8
8
 
9
9
  //
10
10
  // Node-API extensions required for JavaScript engine hosting.
@@ -51,6 +51,16 @@ JSR_API jsr_config_enable_gc_api(jsr_config config, bool value);
51
51
 
52
52
  JSR_API jsr_config_set_explicit_microtasks(jsr_config config, bool value);
53
53
 
54
+ // A callback to process unhandled JS error
55
+ typedef void(NAPI_CDECL* jsr_unhandled_error_cb)(void* cb_data,
56
+ napi_env env,
57
+ napi_value error);
58
+
59
+ JSR_API jsr_config_on_unhandled_error(
60
+ jsr_config config,
61
+ void* cb_data,
62
+ jsr_unhandled_error_cb unhandled_error_cb);
63
+
54
64
  //=============================================================================
55
65
  // jsr_config task runner
56
66
  //=============================================================================
@@ -187,13 +197,18 @@ JSR_API jsr_get_and_clear_last_unhandled_promise_rejection(napi_env env,
187
197
  napi_value* result);
188
198
 
189
199
  // Create new napi_env for the runtime.
190
- JSR_API jsr_create_node_api_env(napi_env root_env,
191
- int32_t api_version,
192
- napi_env* env);
200
+ JSR_API
201
+ jsr_create_node_api_env(napi_env root_env, int32_t api_version, napi_env* env);
193
202
 
194
203
  // Run task in the environment context.
195
204
  JSR_API jsr_run_task(napi_env env, jsr_task_run_cb task_cb, void* data);
196
205
 
206
+ // Initializes native module.
207
+ JSR_API jsr_initialize_native_module(napi_env env,
208
+ napi_addon_register_func register_module,
209
+ int32_t api_version,
210
+ napi_value* exports);
211
+
197
212
  EXTERN_C_END
198
213
 
199
214
  #endif // !SRC_JS_RUNTIME_API_H_
@@ -0,0 +1,270 @@
1
+ #ifndef SRC_NODE_API_H_
2
+ #define SRC_NODE_API_H_
3
+
4
+ #if defined(BUILDING_NODE_EXTENSION) && !defined(NAPI_EXTERN)
5
+ #ifdef _WIN32
6
+ // Building native addon against node
7
+ #define NAPI_EXTERN __declspec(dllimport)
8
+ #elif defined(__wasm__)
9
+ #define NAPI_EXTERN __attribute__((__import_module__("napi")))
10
+ #endif
11
+ #endif
12
+ #include "js_native_api.h"
13
+ #include "node_api_types.h"
14
+
15
+ struct uv_loop_s; // Forward declaration.
16
+
17
+ #ifdef _WIN32
18
+ #define NAPI_MODULE_EXPORT __declspec(dllexport)
19
+ #else
20
+ #ifdef __EMSCRIPTEN__
21
+ #define NAPI_MODULE_EXPORT \
22
+ __attribute__((visibility("default"))) __attribute__((used))
23
+ #else
24
+ #define NAPI_MODULE_EXPORT __attribute__((visibility("default")))
25
+ #endif
26
+ #endif
27
+
28
+ #if defined(__GNUC__)
29
+ #define NAPI_NO_RETURN __attribute__((noreturn))
30
+ #elif defined(_WIN32)
31
+ #define NAPI_NO_RETURN __declspec(noreturn)
32
+ #else
33
+ #define NAPI_NO_RETURN
34
+ #endif
35
+
36
+ typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env,
37
+ napi_value exports);
38
+ typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void);
39
+
40
+ // Used by deprecated registration method napi_module_register.
41
+ typedef struct napi_module {
42
+ int nm_version;
43
+ unsigned int nm_flags;
44
+ const char* nm_filename;
45
+ napi_addon_register_func nm_register_func;
46
+ const char* nm_modname;
47
+ void* nm_priv;
48
+ void* reserved[4];
49
+ } napi_module;
50
+
51
+ #define NAPI_MODULE_VERSION 1
52
+
53
+ #define NAPI_MODULE_INITIALIZER_X(base, version) \
54
+ NAPI_MODULE_INITIALIZER_X_HELPER(base, version)
55
+ #define NAPI_MODULE_INITIALIZER_X_HELPER(base, version) base##version
56
+
57
+ #ifdef __wasm__
58
+ #define NAPI_MODULE_INITIALIZER_BASE napi_register_wasm_v
59
+ #else
60
+ #define NAPI_MODULE_INITIALIZER_BASE napi_register_module_v
61
+ #endif
62
+
63
+ #define NODE_API_MODULE_GET_API_VERSION_BASE node_api_module_get_api_version_v
64
+
65
+ #define NAPI_MODULE_INITIALIZER \
66
+ NAPI_MODULE_INITIALIZER_X(NAPI_MODULE_INITIALIZER_BASE, NAPI_MODULE_VERSION)
67
+
68
+ #define NODE_API_MODULE_GET_API_VERSION \
69
+ NAPI_MODULE_INITIALIZER_X(NODE_API_MODULE_GET_API_VERSION_BASE, \
70
+ NAPI_MODULE_VERSION)
71
+
72
+ #define NAPI_MODULE_INIT() \
73
+ EXTERN_C_START \
74
+ NAPI_MODULE_EXPORT int32_t NODE_API_MODULE_GET_API_VERSION(void) { \
75
+ return NAPI_VERSION; \
76
+ } \
77
+ NAPI_MODULE_EXPORT napi_value NAPI_MODULE_INITIALIZER(napi_env env, \
78
+ napi_value exports); \
79
+ EXTERN_C_END \
80
+ napi_value NAPI_MODULE_INITIALIZER(napi_env env, napi_value exports)
81
+
82
+ #define NAPI_MODULE(modname, regfunc) \
83
+ NAPI_MODULE_INIT() { \
84
+ return regfunc(env, exports); \
85
+ }
86
+
87
+ // Deprecated. Use NAPI_MODULE.
88
+ #define NAPI_MODULE_X(modname, regfunc, priv, flags) \
89
+ NAPI_MODULE(modname, regfunc)
90
+
91
+ EXTERN_C_START
92
+
93
+ // Deprecated. Replaced by symbol-based registration defined by NAPI_MODULE
94
+ // and NAPI_MODULE_INIT macros.
95
+ NAPI_EXTERN void NAPI_CDECL napi_module_register(napi_module* mod);
96
+
97
+ NAPI_EXTERN NAPI_NO_RETURN void NAPI_CDECL
98
+ napi_fatal_error(const char* location,
99
+ size_t location_len,
100
+ const char* message,
101
+ size_t message_len);
102
+
103
+ // Methods for custom handling of async operations
104
+ NAPI_EXTERN napi_status NAPI_CDECL
105
+ napi_async_init(napi_env env,
106
+ napi_value async_resource,
107
+ napi_value async_resource_name,
108
+ napi_async_context* result);
109
+
110
+ NAPI_EXTERN napi_status NAPI_CDECL
111
+ napi_async_destroy(napi_env env, napi_async_context async_context);
112
+
113
+ NAPI_EXTERN napi_status NAPI_CDECL
114
+ napi_make_callback(napi_env env,
115
+ napi_async_context async_context,
116
+ napi_value recv,
117
+ napi_value func,
118
+ size_t argc,
119
+ const napi_value* argv,
120
+ napi_value* result);
121
+
122
+ // Methods to provide node::Buffer functionality with napi types
123
+ NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer(napi_env env,
124
+ size_t length,
125
+ void** data,
126
+ napi_value* result);
127
+ #ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
128
+ NAPI_EXTERN napi_status NAPI_CDECL
129
+ napi_create_external_buffer(napi_env env,
130
+ size_t length,
131
+ void* data,
132
+ node_api_basic_finalize finalize_cb,
133
+ void* finalize_hint,
134
+ napi_value* result);
135
+ #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
136
+
137
+ #if NAPI_VERSION >= 10
138
+
139
+ NAPI_EXTERN napi_status NAPI_CDECL
140
+ node_api_create_buffer_from_arraybuffer(napi_env env,
141
+ napi_value arraybuffer,
142
+ size_t byte_offset,
143
+ size_t byte_length,
144
+ napi_value* result);
145
+ #endif // NAPI_VERSION >= 10
146
+
147
+ NAPI_EXTERN napi_status NAPI_CDECL napi_create_buffer_copy(napi_env env,
148
+ size_t length,
149
+ const void* data,
150
+ void** result_data,
151
+ napi_value* result);
152
+ NAPI_EXTERN napi_status NAPI_CDECL napi_is_buffer(napi_env env,
153
+ napi_value value,
154
+ bool* result);
155
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_buffer_info(napi_env env,
156
+ napi_value value,
157
+ void** data,
158
+ size_t* length);
159
+
160
+ // Methods to manage simple async operations
161
+ NAPI_EXTERN napi_status NAPI_CDECL
162
+ napi_create_async_work(napi_env env,
163
+ napi_value async_resource,
164
+ napi_value async_resource_name,
165
+ napi_async_execute_callback execute,
166
+ napi_async_complete_callback complete,
167
+ void* data,
168
+ napi_async_work* result);
169
+ NAPI_EXTERN napi_status NAPI_CDECL napi_delete_async_work(napi_env env,
170
+ napi_async_work work);
171
+ NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(node_api_basic_env env,
172
+ napi_async_work work);
173
+ NAPI_EXTERN napi_status NAPI_CDECL
174
+ napi_cancel_async_work(node_api_basic_env env, napi_async_work work);
175
+
176
+ // version management
177
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_node_version(
178
+ node_api_basic_env env, const napi_node_version** version);
179
+
180
+ #if NAPI_VERSION >= 2
181
+
182
+ // Return the current libuv event loop for a given environment
183
+ NAPI_EXTERN napi_status NAPI_CDECL
184
+ napi_get_uv_event_loop(node_api_basic_env env, struct uv_loop_s** loop);
185
+
186
+ #endif // NAPI_VERSION >= 2
187
+
188
+ #if NAPI_VERSION >= 3
189
+
190
+ NAPI_EXTERN napi_status NAPI_CDECL napi_fatal_exception(napi_env env,
191
+ napi_value err);
192
+
193
+ NAPI_EXTERN napi_status NAPI_CDECL napi_add_env_cleanup_hook(
194
+ node_api_basic_env env, napi_cleanup_hook fun, void* arg);
195
+
196
+ NAPI_EXTERN napi_status NAPI_CDECL napi_remove_env_cleanup_hook(
197
+ node_api_basic_env env, napi_cleanup_hook fun, void* arg);
198
+
199
+ NAPI_EXTERN napi_status NAPI_CDECL
200
+ napi_open_callback_scope(napi_env env,
201
+ napi_value resource_object,
202
+ napi_async_context context,
203
+ napi_callback_scope* result);
204
+
205
+ NAPI_EXTERN napi_status NAPI_CDECL
206
+ napi_close_callback_scope(napi_env env, napi_callback_scope scope);
207
+
208
+ #endif // NAPI_VERSION >= 3
209
+
210
+ #if NAPI_VERSION >= 4
211
+
212
+ // Calling into JS from other threads
213
+ NAPI_EXTERN napi_status NAPI_CDECL
214
+ napi_create_threadsafe_function(napi_env env,
215
+ napi_value func,
216
+ napi_value async_resource,
217
+ napi_value async_resource_name,
218
+ size_t max_queue_size,
219
+ size_t initial_thread_count,
220
+ void* thread_finalize_data,
221
+ napi_finalize thread_finalize_cb,
222
+ void* context,
223
+ napi_threadsafe_function_call_js call_js_cb,
224
+ napi_threadsafe_function* result);
225
+
226
+ NAPI_EXTERN napi_status NAPI_CDECL napi_get_threadsafe_function_context(
227
+ napi_threadsafe_function func, void** result);
228
+
229
+ NAPI_EXTERN napi_status NAPI_CDECL
230
+ napi_call_threadsafe_function(napi_threadsafe_function func,
231
+ void* data,
232
+ napi_threadsafe_function_call_mode is_blocking);
233
+
234
+ NAPI_EXTERN napi_status NAPI_CDECL
235
+ napi_acquire_threadsafe_function(napi_threadsafe_function func);
236
+
237
+ NAPI_EXTERN napi_status NAPI_CDECL napi_release_threadsafe_function(
238
+ napi_threadsafe_function func, napi_threadsafe_function_release_mode mode);
239
+
240
+ NAPI_EXTERN napi_status NAPI_CDECL napi_unref_threadsafe_function(
241
+ node_api_basic_env env, napi_threadsafe_function func);
242
+
243
+ NAPI_EXTERN napi_status NAPI_CDECL napi_ref_threadsafe_function(
244
+ node_api_basic_env env, napi_threadsafe_function func);
245
+
246
+ #endif // NAPI_VERSION >= 4
247
+
248
+ #if NAPI_VERSION >= 8
249
+
250
+ NAPI_EXTERN napi_status NAPI_CDECL
251
+ napi_add_async_cleanup_hook(node_api_basic_env env,
252
+ napi_async_cleanup_hook hook,
253
+ void* arg,
254
+ napi_async_cleanup_hook_handle* remove_handle);
255
+
256
+ NAPI_EXTERN napi_status NAPI_CDECL
257
+ napi_remove_async_cleanup_hook(napi_async_cleanup_hook_handle remove_handle);
258
+
259
+ #endif // NAPI_VERSION >= 8
260
+
261
+ #if NAPI_VERSION >= 9
262
+
263
+ NAPI_EXTERN napi_status NAPI_CDECL
264
+ node_api_get_module_file_name(node_api_basic_env env, const char** result);
265
+
266
+ #endif // NAPI_VERSION >= 9
267
+
268
+ EXTERN_C_END
269
+
270
+ #endif // SRC_NODE_API_H_
@@ -0,0 +1,52 @@
1
+ #ifndef SRC_NODE_API_TYPES_H_
2
+ #define SRC_NODE_API_TYPES_H_
3
+
4
+ #include "js_native_api_types.h"
5
+
6
+ typedef struct napi_callback_scope__* napi_callback_scope;
7
+ typedef struct napi_async_context__* napi_async_context;
8
+ typedef struct napi_async_work__* napi_async_work;
9
+
10
+ #if NAPI_VERSION >= 3
11
+ typedef void(NAPI_CDECL* napi_cleanup_hook)(void* arg);
12
+ #endif // NAPI_VERSION >= 3
13
+
14
+ #if NAPI_VERSION >= 4
15
+ typedef struct napi_threadsafe_function__* napi_threadsafe_function;
16
+ #endif // NAPI_VERSION >= 4
17
+
18
+ #if NAPI_VERSION >= 4
19
+ typedef enum {
20
+ napi_tsfn_release,
21
+ napi_tsfn_abort
22
+ } napi_threadsafe_function_release_mode;
23
+
24
+ typedef enum {
25
+ napi_tsfn_nonblocking,
26
+ napi_tsfn_blocking
27
+ } napi_threadsafe_function_call_mode;
28
+ #endif // NAPI_VERSION >= 4
29
+
30
+ typedef void(NAPI_CDECL* napi_async_execute_callback)(napi_env env, void* data);
31
+ typedef void(NAPI_CDECL* napi_async_complete_callback)(napi_env env,
32
+ napi_status status,
33
+ void* data);
34
+ #if NAPI_VERSION >= 4
35
+ typedef void(NAPI_CDECL* napi_threadsafe_function_call_js)(
36
+ napi_env env, napi_value js_callback, void* context, void* data);
37
+ #endif // NAPI_VERSION >= 4
38
+
39
+ typedef struct {
40
+ uint32_t major;
41
+ uint32_t minor;
42
+ uint32_t patch;
43
+ const char* release;
44
+ } napi_node_version;
45
+
46
+ #if NAPI_VERSION >= 8
47
+ typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
48
+ typedef void(NAPI_CDECL* napi_async_cleanup_hook)(
49
+ napi_async_cleanup_hook_handle handle, void* data);
50
+ #endif // NAPI_VERSION >= 8
51
+
52
+ #endif // SRC_NODE_API_TYPES_H_
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.80.1</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.80.6</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>80</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>1</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>6</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>220e035c393ea33ba5ddbbf668a576f4334b8928</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>fb0c0cd0305a26b0e7be159084a39f19e3edd7b9</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -6,7 +6,7 @@
6
6
  <!-- Enabling this will (1) Include hermes glues in the Microsoft.ReactNative binaries AND (2) Make hermes the default engine -->
7
7
  <UseHermes Condition="'$(UseHermes)' == ''">true</UseHermes>
8
8
  <!-- This will be true if (1) the client want to use hermes by setting UseHermes to true OR (2) We are building for UWP where dynamic switching is enabled -->
9
- <HermesVersion Condition="'$(HermesVersion)' == ''">0.0.0-2507.21007-eda7aef6</HermesVersion>
9
+ <HermesVersion Condition="'$(HermesVersion)' == ''">0.0.0-2511.7001-d7ca19b3</HermesVersion>
10
10
  <HermesPackage Condition="'$(HermesPackage)' == '' And Exists('$(PkgMicrosoft_JavaScript_Hermes)')">$(PkgMicrosoft_JavaScript_Hermes)</HermesPackage>
11
11
  <HermesPackage Condition="'$(HermesPackage)' == ''">$(NuGetPackageRoot)\Microsoft.JavaScript.Hermes\$(HermesVersion)</HermesPackage>
12
12
  <EnableHermesInspectorInReleaseFlavor Condition="'$(EnableHermesInspectorInReleaseFlavor)' == ''">false</EnableHermesInspectorInReleaseFlavor>
@@ -61,7 +61,7 @@
61
61
  <Import Condition="'$(JsEnginePropsDefined)' == ''" Project="$(ReactNativeWindowsDir)PropertySheets\JSEngine.props" />
62
62
  <ItemDefinitionGroup>
63
63
  <ClCompile>
64
- <PreprocessorDefinitions Condition="'$(UseHermes)'=='true'">USE_HERMES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
64
+ <PreprocessorDefinitions Condition="'$(UseHermes)'=='true'">USE_HERMES;REACT_NATIVE_DEBUGGER_ENABLED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
65
65
  <PreprocessorDefinitions Condition="'$(EnableDevServerHBCBundles)'=='true'">ENABLE_DEVSERVER_HBCBUNDLES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
66
66
  <PreprocessorDefinitions Condition="'$(UseV8)'=='true'">USE_V8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
67
67
  <PreprocessorDefinitions Condition="'$(UseFabric)'=='true'">USE_FABRIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -136,7 +136,7 @@
136
136
  </PreprocessorDefinitions>
137
137
  <LanguageStandard>$(CppStandard)</LanguageStandard>
138
138
  <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
139
- <RuntimeTypeInfo>false</RuntimeTypeInfo>
139
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>
140
140
  <ShowIncludes Condition="'$(ShowIncludes)'=='true'">true</ShowIncludes>
141
141
  <AdditionalOptions>/utf-8 %(AdditionalOptions) /await</AdditionalOptions>
142
142
  <ControlFlowGuard>Guard</ControlFlowGuard>
@@ -114,6 +114,13 @@
114
114
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSIExecutor.h" />
115
115
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.h" />
116
116
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorInterfaces.h" />
117
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\cdp\CdpJson.h" />
118
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTarget.h" />
119
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\NetworkIOAgent.h" />
120
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\RuntimeAgent.h" />
121
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\TracingAgent.h" />
122
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\FallbackRuntimeAgentDelegate.h" />
123
+ <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InstanceAgent.h" />
117
124
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\RuntimeSamplingProfile.h" />
118
125
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\InstanceTracingProfile.h" />
119
126
  <ClInclude Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\EventLoopReporter.h" />
@@ -145,10 +152,18 @@
145
152
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsiexecutor\jsireact\JSINativeModules.cpp" />
146
153
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorInterfaces.cpp" />
147
154
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorFlags.cpp" />
155
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorPackagerConnection.cpp" />
156
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\cdp\CdpJson.cpp" />
157
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTarget.cpp" />
158
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\NetworkIOAgent.cpp" />
159
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\RuntimeAgent.cpp" />
160
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\TracingAgent.cpp" />
161
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\FallbackRuntimeAgentDelegate.cpp" />
162
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InstanceAgent.cpp" />
148
163
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\EventLoopReporter.cpp" />
149
164
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\RuntimeSamplingProfileTraceEventSerializer.cpp" />
150
165
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\PerformanceTracer.cpp" />
151
- <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsitooling\react\runtime\JSRuntimeFactory.cpp"/>
166
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsitooling\react\runtime\JSRuntimeFactory.cpp" />
152
167
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\logger\react_native_log.cpp" />
153
168
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\fusebox\FuseboxTracer.cpp" />
154
169
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\reactperflogger\BridgeNativeModulePerfLogger.cpp" />
@@ -184,6 +199,8 @@
184
199
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\performance\timeline\PerformanceObserver.cpp" />
185
200
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\performance\timeline\PerformanceEntryKeyedBuffer.cpp" />
186
201
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\network\NetworkReporter.cpp" />
202
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\network\CdpNetwork.cpp" />
203
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\network\HttpUtils.cpp" />
187
204
  <ClCompile Include="$(YogaDir)\yoga\event\event.cpp" />
188
205
  <ClCompile Include="pch.cpp">
189
206
  <PrecompiledHeader>Create</PrecompiledHeader>
@@ -341,7 +341,7 @@ NativeToJsBridge::getDecoratedNativeMethodCallInvoker(
341
341
 
342
342
  jsinspector_modern::RuntimeTargetDelegate&
343
343
  NativeToJsBridge::getInspectorTargetDelegate() {
344
- return *m_executor;
344
+ return m_executor->getRuntimeTargetDelegate();
345
345
  }
346
346
 
347
347
  } // namespace facebook::react
@@ -1173,7 +1173,7 @@ TEST_P(JSITest, DecoratorTest) {
1173
1173
 
1174
1174
  class CountRuntime final : public WithRuntimeDecorator<Count> {
1175
1175
  public:
1176
- explicit CountRuntime(std::unique_ptr<Runtime> rt)
1176
+ explicit CountRuntime(std::shared_ptr<Runtime> rt)
1177
1177
  : WithRuntimeDecorator<Count>(*rt, count_),
1178
1178
  rt_(std::move(rt)),
1179
1179
  count_(kInit) {}
@@ -1183,7 +1183,7 @@ TEST_P(JSITest, DecoratorTest) {
1183
1183
  }
1184
1184
 
1185
1185
  private:
1186
- std::unique_ptr<Runtime> rt_;
1186
+ std::shared_ptr<Runtime> rt_;
1187
1187
  Count count_;
1188
1188
  };
1189
1189
 
@@ -1222,7 +1222,7 @@ TEST_P(JSITest, MultiDecoratorTest) {
1222
1222
  class MultiRuntime final
1223
1223
  : public WithRuntimeDecorator<std::tuple<Inc, Nest>> {
1224
1224
  public:
1225
- explicit MultiRuntime(std::unique_ptr<Runtime> rt)
1225
+ explicit MultiRuntime(std::shared_ptr<Runtime> rt)
1226
1226
  : WithRuntimeDecorator<std::tuple<Inc, Nest>>(*rt, tuple_),
1227
1227
  rt_(std::move(rt)) {}
1228
1228
 
@@ -1234,7 +1234,7 @@ TEST_P(JSITest, MultiDecoratorTest) {
1234
1234
  }
1235
1235
 
1236
1236
  private:
1237
- std::unique_ptr<Runtime> rt_;
1237
+ std::shared_ptr<Runtime> rt_;
1238
1238
  std::tuple<Inc, Nest> tuple_;
1239
1239
  };
1240
1240
 
@@ -14,6 +14,7 @@
14
14
  #include <jsinspector-modern/network/NetworkReporter.h>
15
15
 
16
16
  #include <sstream>
17
+ #include <tuple>
17
18
  #include <utility>
18
19
  #include <variant>
19
20
 
@@ -21,6 +22,7 @@ namespace facebook::react::jsinspector_modern {
21
22
 
22
23
  static constexpr long DEFAULT_BYTES_PER_READ =
23
24
  1048576; // 1MB (Chrome v112 default)
25
+ static constexpr unsigned long MAX_BYTES_PER_READ = 10485760; // 10MB
24
26
 
25
27
  // https://github.com/chromium/chromium/blob/128.0.6593.1/content/browser/devtools/devtools_io_context.cc#L71-L73
26
28
  static constexpr std::array kTextMIMETypePrefixes{
@@ -31,7 +33,7 @@ static constexpr std::array kTextMIMETypePrefixes{
31
33
  "application/javascript" // Not in Chromium but emitted by Metro
32
34
  };
33
35
 
34
- // namespace { [Windows #13587]
36
+ namespace {
35
37
 
36
38
  struct InitStreamResult {
37
39
  uint32_t httpStatusCode;
@@ -45,6 +47,8 @@ using StreamInitCallback =
45
47
  using IOReadCallback =
46
48
  std::function<void(std::variant<IOReadError, IOReadResult>)>;
47
49
 
50
+ } // namespace [Windows #13587]
51
+
48
52
  /**
49
53
  * Private class owning state and implementing the listener for a particular
50
54
  * request
@@ -58,7 +62,7 @@ class Stream : public NetworkRequestListener,
58
62
  Stream(const Stream& other) = delete;
59
63
  Stream& operator=(const Stream& other) = delete;
60
64
  Stream(Stream&& other) = default;
61
- Stream& operator=(Stream&& other) = default;
65
+ Stream& operator=(Stream&& other) noexcept = default;
62
66
 
63
67
  /**
64
68
  * Factory method to create a Stream with a callback for the initial result
@@ -71,9 +75,9 @@ class Stream : public NetworkRequestListener,
71
75
  */
72
76
  static std::shared_ptr<Stream> create(
73
77
  VoidExecutor executor,
74
- StreamInitCallback initCb) {
78
+ const StreamInitCallback& initCb) {
75
79
  std::shared_ptr<Stream> stream{new Stream(initCb)};
76
- stream->setExecutor(executor);
80
+ stream->setExecutor(std::move(executor));
77
81
  return stream;
78
82
  }
79
83
 
@@ -86,8 +90,7 @@ class Stream : public NetworkRequestListener,
86
90
  * with the result of the read, or an error string.
87
91
  */
88
92
  void read(long maxBytesToRead, const IOReadCallback& callback) {
89
- pendingReadRequests_.emplace_back(
90
- std::make_tuple(maxBytesToRead, callback));
93
+ pendingReadRequests_.emplace_back(maxBytesToRead, callback);
91
94
  processPending();
92
95
  }
93
96
 
@@ -291,8 +294,8 @@ bool NetworkIOAgent::handleRequest(
291
294
 
292
295
  // @cdp Network.getResponseBody support is experimental.
293
296
  if (req.method == "Network.getResponseBody") {
294
- // TODO(T218468200)
295
- return false;
297
+ handleGetResponseBody(req);
298
+ return true;
296
299
  }
297
300
  }
298
301
 
@@ -404,9 +407,17 @@ void NetworkIOAgent::handleIoRead(const cdp::PreparsedRequest& req) {
404
407
  "Invalid params: handle is missing or not a string."));
405
408
  return;
406
409
  }
407
- std::optional<int64_t> size = std::nullopt; // [Windows #13587]
410
+ std::optional<int64_t> size = std::nullopt;
408
411
  if ((req.params.count("size") != 0u) && req.params.at("size").isInt()) {
409
412
  size = req.params.at("size").asInt();
413
+
414
+ if (size > MAX_BYTES_PER_READ) {
415
+ frontendChannel_(cdp::jsonError(
416
+ requestId,
417
+ cdp::ErrorCode::InvalidParams,
418
+ "Invalid params: size cannot be greater than 10MB."));
419
+ return;
420
+ }
410
421
  }
411
422
 
412
423
  auto streamId = req.params.at("handle").asString();
@@ -471,4 +482,7 @@ void NetworkIOAgent::handleIoClose(const cdp::PreparsedRequest& req) {
471
482
  }
472
483
  }
473
484
 
485
+ void NetworkIOAgent::handleGetResponseBody(const cdp::PreparsedRequest& /*req*/) {
486
+ }
487
+
474
488
  } // namespace facebook::react::jsinspector_modern
@@ -88,6 +88,17 @@ struct IOReadResult {
88
88
  }
89
89
  };
90
90
 
91
+ struct GetResponseBodyResult {
92
+ std::string body;
93
+ bool base64Encoded;
94
+ folly::dynamic toDynamic() const {
95
+ folly::dynamic params = folly::dynamic::object;
96
+ params["body"] = body;
97
+ params["base64Encoded"] = base64Encoded;
98
+ return params;
99
+ }
100
+ };
101
+
91
102
  /**
92
103
  * Passed to `loadNetworkResource`, provides callbacks for processing incoming
93
104
  * data and other events.
@@ -259,6 +270,11 @@ class NetworkIOAgent {
259
270
  * Reports CDP ok if the stream is found, or a CDP error if not.
260
271
  */
261
272
  void handleIoClose(const cdp::PreparsedRequest& req);
273
+
274
+ /**
275
+ * Handle a Network.getResponseBody CDP request.
276
+ */
277
+ void handleGetResponseBody(const cdp::PreparsedRequest& req);
262
278
  };
263
279
 
264
280
  } // namespace facebook::react::jsinspector_modern
@@ -6,7 +6,7 @@
6
6
  "Type": "git",
7
7
  "Git": {
8
8
  "RepositoryUrl": "https://github.com/microsoft/node-api-jsi",
9
- "CommitHash": "980cb60d7911237d0f647fc566543ef627adac70"
9
+ "CommitHash": "21b47f08b762b21b1d4d970940ab23f59f43249c"
10
10
  }
11
11
  },
12
12
  "DevelopmentDependency": false
@@ -78,6 +78,8 @@ New-Item $MSRNCxxTargetRoot\node-api -ItemType Directory -Force
78
78
  Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_native_api.h -Destination $MSRNCxxTargetRoot\node-api\
79
79
  Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_native_api_types.h -Destination $MSRNCxxTargetRoot\node-api\
80
80
  Copy-Item -Force -Path $NodeApiJsiRoot\node-api\js_runtime_api.h -Destination $MSRNCxxTargetRoot\node-api\
81
+ Copy-Item -Force -Path $NodeApiJsiRoot\node-api\node_api.h -Destination $MSRNCxxTargetRoot\node-api\
82
+ Copy-Item -Force -Path $NodeApiJsiRoot\node-api\node_api_types.h -Destination $MSRNCxxTargetRoot\node-api\
81
83
 
82
84
  # Microsoft.ReactNative.CXX project Node-API JSI files
83
85
  New-Item $MSRNCxxTargetRoot\ApiLoaders -ItemType Directory -Force