react-native-windows 0.80.1 → 0.80.5
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.
- package/Directory.Build.props +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.cpp +169 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggerUIIsland.h +42 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +60 -33
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +68 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +9 -0
- package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +5 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +6 -1
- package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +14 -1
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.cpp +75 -24
- package/Microsoft.ReactNative/Fabric/platform/react/threading/TaskDispatchThread.h +4 -25
- package/Microsoft.ReactNative/JsiApi.cpp +1 -1
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -0
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +3 -0
- package/Microsoft.ReactNative/ReactHost/DebuggerNotifications.h +54 -0
- package/Microsoft.ReactNative/ReactHost/React.h +11 -4
- package/Microsoft.ReactNative/ReactHost/ReactHost.cpp +195 -29
- package/Microsoft.ReactNative/ReactHost/ReactHost.h +22 -4
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +24 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
- package/Microsoft.ReactNative/ReactRootView.cpp +108 -0
- package/Microsoft.ReactNative/ReactRootView.h +6 -0
- package/Microsoft.ReactNative/Views/DevMenu.cpp +1 -1
- package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +1 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/JSEngine.props +1 -1
- package/PropertySheets/React.Cpp.props +2 -2
- package/ReactCommon/ReactCommon.vcxproj +18 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +1 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +4 -4
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.cpp +23 -9
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsinspector-modern/NetworkIOAgent.h +16 -0
- package/ReactCommon/cgmanifest.json +1 -1
- package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +2 -0
- package/Shared/DevServerHelper.h +13 -3
- package/Shared/DevSettings.h +7 -0
- package/Shared/DevSupportManager.cpp +79 -20
- package/Shared/DevSupportManager.h +7 -19
- package/Shared/Hermes/HermesRuntimeAgentDelegate.cpp +99 -0
- package/Shared/Hermes/HermesRuntimeAgentDelegate.h +81 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.cpp +263 -0
- package/Shared/Hermes/HermesRuntimeTargetDelegate.h +77 -0
- package/Shared/HermesRuntimeHolder.cpp +29 -111
- package/Shared/HermesRuntimeHolder.h +214 -32
- package/Shared/IDevSupportManager.h +5 -2
- package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.cpp +108 -0
- package/Shared/Inspector/ReactInspectorPackagerConnectionDelegate.h +19 -0
- package/Shared/Inspector/ReactInspectorThread.h +18 -0
- package/Shared/JSI/RuntimeHolder.h +5 -2
- package/Shared/OInstance.cpp +44 -27
- package/Shared/Shared.vcxitems +27 -17
- package/Shared/Shared.vcxitems.filters +33 -15
- package/package.json +4 -4
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.cpp +0 -79
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.h +0 -51
- package/Microsoft.ReactNative.Cxx/ApiLoaders/JSRuntimeApi.inc +0 -50
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.cpp +0 -41
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.h +0 -127
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi.inc +0 -125
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_posix.cpp +0 -16
- package/Microsoft.ReactNative.Cxx/ApiLoaders/NodeApi_win.cpp +0 -23
- package/Microsoft.ReactNative.Cxx/JSI/decorator.h +0 -1054
- package/Microsoft.ReactNative.Cxx/JSI/instrumentation.h +0 -145
- package/Microsoft.ReactNative.Cxx/JSI/jsi-inl.h +0 -372
- package/Microsoft.ReactNative.Cxx/JSI/jsi.cpp +0 -797
- package/Microsoft.ReactNative.Cxx/JSI/jsi.h +0 -1799
- package/Microsoft.ReactNative.Cxx/JSI/threadsafe.h +0 -79
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.cpp +0 -3531
- package/Microsoft.ReactNative.Cxx/NodeApiJsiRuntime.h +0 -38
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api.h +0 -614
- package/Microsoft.ReactNative.Cxx/node-api/js_native_api_types.h +0 -212
- package/Microsoft.ReactNative.Cxx/node-api/js_runtime_api.h +0 -199
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +0 -78
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +0 -196
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jserrorhandler/JsErrorHandler.cpp +0 -429
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.cpp +0 -45
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsitooling/react/runtime/JSRuntimeFactory.h +0 -91
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +0 -670
- package/Shared/InspectorPackagerConnection.cpp +0 -232
- package/Shared/InspectorPackagerConnection.h +0 -61
- /package/Shared/{HermesSamplingProfiler.cpp → Hermes/HermesSamplingProfiler.cpp} +0 -0
- /package/Shared/{HermesSamplingProfiler.h → Hermes/HermesSamplingProfiler.h} +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#pragma once
|
|
5
5
|
|
|
6
|
+
#include <jsinspector-modern/HostTarget.h>
|
|
6
7
|
#include <mutex>
|
|
7
8
|
#include <unordered_map>
|
|
8
9
|
#include "AsyncActionQueue.h"
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
|
|
16
17
|
namespace Mso::React {
|
|
17
18
|
|
|
19
|
+
class ReactInspectorHostTargetDelegate;
|
|
18
20
|
class ReactViewHost;
|
|
19
21
|
|
|
20
22
|
//! ReactHost manages lifetime of ReactNative instance.
|
|
@@ -52,9 +54,6 @@ class ReactHost final : public Mso::ActiveObject<IReactHost> {
|
|
|
52
54
|
|
|
53
55
|
Mso::CntPtr<AsyncActionQueue> ActionQueue() const noexcept;
|
|
54
56
|
|
|
55
|
-
Mso::Future<void> LoadInQueue(ReactOptions &&options) noexcept;
|
|
56
|
-
Mso::Future<void> UnloadInQueue(size_t unloadActionId) noexcept;
|
|
57
|
-
|
|
58
57
|
void Close() noexcept;
|
|
59
58
|
bool IsClosed() const noexcept;
|
|
60
59
|
|
|
@@ -64,6 +63,12 @@ class ReactHost final : public Mso::ActiveObject<IReactHost> {
|
|
|
64
63
|
template <class TCallback>
|
|
65
64
|
Mso::Future<void> PostInQueue(TCallback &&callback) noexcept;
|
|
66
65
|
|
|
66
|
+
private:
|
|
67
|
+
enum class UnloadReason {
|
|
68
|
+
Unload,
|
|
69
|
+
CloseHost,
|
|
70
|
+
};
|
|
71
|
+
|
|
67
72
|
private:
|
|
68
73
|
friend MakePolicy;
|
|
69
74
|
ReactHost(Mso::DispatchQueue const &queue) noexcept;
|
|
@@ -75,9 +80,18 @@ class ReactHost final : public Mso::ActiveObject<IReactHost> {
|
|
|
75
80
|
void ForEachViewHost(const Mso::FunctorRef<void(ReactViewHost &)> &action) noexcept;
|
|
76
81
|
|
|
77
82
|
AsyncAction MakeLoadInstanceAction(ReactOptions &&options) noexcept;
|
|
78
|
-
AsyncAction MakeUnloadInstanceAction() noexcept;
|
|
83
|
+
AsyncAction MakeUnloadInstanceAction(UnloadReason reason) noexcept;
|
|
84
|
+
|
|
85
|
+
Mso::Future<void> LoadInQueue(ReactOptions &&options) noexcept;
|
|
86
|
+
Mso::Future<void> UnloadInQueue(UnloadReason reason, size_t unloadActionId) noexcept;
|
|
87
|
+
|
|
88
|
+
void OnDebuggerResume() noexcept;
|
|
89
|
+
bool IsInspectable() noexcept;
|
|
90
|
+
void AddInspectorPage() noexcept;
|
|
91
|
+
void RemoveInspectorPage() noexcept;
|
|
79
92
|
|
|
80
93
|
private:
|
|
94
|
+
friend class ReactInspectorHostTargetDelegate;
|
|
81
95
|
mutable std::mutex m_mutex;
|
|
82
96
|
const Mso::InvokeElsePostExecutor m_executor{Queue()};
|
|
83
97
|
const Mso::ActiveReadableField<Mso::CntPtr<AsyncActionQueue>> m_actionQueue{
|
|
@@ -92,6 +106,10 @@ class ReactHost final : public Mso::ActiveObject<IReactHost> {
|
|
|
92
106
|
size_t m_pendingUnloadActionId{0};
|
|
93
107
|
size_t m_nextUnloadActionId{0};
|
|
94
108
|
const Mso::ActiveField<bool> m_isInstanceUnloading{false, Queue()};
|
|
109
|
+
|
|
110
|
+
const std::shared_ptr<facebook::react::jsinspector_modern::HostTargetDelegate> m_inspectorHostTargetDelegate;
|
|
111
|
+
const std::shared_ptr<facebook::react::jsinspector_modern::HostTarget> m_inspectorHostTarget;
|
|
112
|
+
const Mso::ActiveField<std::optional<int32_t>> m_inspectorPageId{Queue()};
|
|
95
113
|
};
|
|
96
114
|
|
|
97
115
|
//! Implements a cross-platform host for a React view
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
#include <react/runtime/PlatformTimerRegistry.h>
|
|
67
67
|
#include <react/runtime/TimerManager.h>
|
|
68
68
|
#include <react/threading/MessageQueueThreadImpl.h>
|
|
69
|
+
#include "Inspector/ReactInspectorThread.h"
|
|
69
70
|
#endif
|
|
70
71
|
|
|
71
72
|
#if !defined(CORE_ABI) && !defined(USE_FABRIC)
|
|
@@ -553,6 +554,8 @@ std::shared_ptr<facebook::react::DevSettings> ReactInstanceWin::CreateDevSetting
|
|
|
553
554
|
|
|
554
555
|
devSettings->useRuntimeScheduler = useRuntimeScheduler;
|
|
555
556
|
|
|
557
|
+
devSettings->inspectorHostTarget = m_options.InspectorHostTarget;
|
|
558
|
+
|
|
556
559
|
return devSettings;
|
|
557
560
|
}
|
|
558
561
|
|
|
@@ -664,16 +667,21 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
664
667
|
};
|
|
665
668
|
|
|
666
669
|
if (devSettings->useDirectDebugger) {
|
|
667
|
-
::Microsoft::ReactNative::GetSharedDevManager()->
|
|
668
|
-
devSettings->sourceBundleHost, devSettings->sourceBundlePort);
|
|
670
|
+
::Microsoft::ReactNative::GetSharedDevManager()->EnsureInspectorPackagerConnection(
|
|
671
|
+
devSettings->sourceBundleHost, devSettings->sourceBundlePort, devSettings->bundleAppId);
|
|
669
672
|
}
|
|
670
673
|
|
|
671
674
|
m_jsiRuntimeHolder = std::make_shared<Microsoft::ReactNative::HermesRuntimeHolder>(
|
|
672
675
|
devSettings, jsMessageThread, CreatePreparedScriptStore());
|
|
673
676
|
auto jsRuntime = std::make_unique<Microsoft::ReactNative::HermesJSRuntime>(m_jsiRuntimeHolder);
|
|
674
677
|
jsRuntime->getRuntime();
|
|
675
|
-
|
|
676
|
-
|
|
678
|
+
|
|
679
|
+
m_bridgelessReactInstance = std::make_shared<facebook::react::ReactInstance>(
|
|
680
|
+
std::move(jsRuntime),
|
|
681
|
+
jsMessageThread,
|
|
682
|
+
timerManager,
|
|
683
|
+
jsErrorHandlingFunc,
|
|
684
|
+
m_options.InspectorHostTarget);
|
|
677
685
|
|
|
678
686
|
auto bufferedRuntimeExecutor = m_bridgelessReactInstance->getBufferedRuntimeExecutor();
|
|
679
687
|
timerManager->setRuntimeExecutor(bufferedRuntimeExecutor);
|
|
@@ -695,6 +703,7 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
695
703
|
winrt::make<implementation::ReactContext>(Mso::Copy(m_reactContext)));
|
|
696
704
|
|
|
697
705
|
facebook::react::ReactInstance::JSRuntimeFlags options;
|
|
706
|
+
|
|
698
707
|
m_bridgelessReactInstance->initializeRuntime(
|
|
699
708
|
options,
|
|
700
709
|
[=, onCreated = m_options.OnInstanceCreated, reactContext = m_reactContext](
|
|
@@ -748,7 +757,6 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
|
|
|
748
757
|
|
|
749
758
|
LoadJSBundlesBridgeless(devSettings);
|
|
750
759
|
SetupHMRClient();
|
|
751
|
-
|
|
752
760
|
} catch (std::exception &e) {
|
|
753
761
|
OnErrorWithMessage(e.what());
|
|
754
762
|
OnErrorWithMessage("ReactInstanceWin: Failed to create React Instance.");
|
|
@@ -1092,6 +1100,17 @@ Mso::Future<void> ReactInstanceWin::Destroy() noexcept {
|
|
|
1092
1100
|
if (m_bridgelessReactInstance) {
|
|
1093
1101
|
if (auto jsMessageThread = m_jsMessageThread.Exchange(nullptr)) {
|
|
1094
1102
|
jsMessageThread->runOnQueueSync([&]() noexcept {
|
|
1103
|
+
// Unregister from inspector BEFORE shutting down JS thread
|
|
1104
|
+
if (m_bridgelessReactInstance && m_options.InspectorHostTarget) {
|
|
1105
|
+
Mso::React::MessageDispatchQueue messageDispatchQueue{
|
|
1106
|
+
::Microsoft::ReactNative::ReactInspectorThread::Instance(), nullptr};
|
|
1107
|
+
messageDispatchQueue.runOnQueueSync(
|
|
1108
|
+
[weakBridgelessReactInstance = std::weak_ptr(m_bridgelessReactInstance)]() {
|
|
1109
|
+
if (auto bridgelessReactInstance = weakBridgelessReactInstance.lock()) {
|
|
1110
|
+
bridgelessReactInstance->unregisterFromInspector();
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1095
1114
|
{
|
|
1096
1115
|
// Release the JSI runtime
|
|
1097
1116
|
std::scoped_lock lock{m_mutex};
|
|
@@ -205,7 +205,7 @@ class ReactInstanceWin final : public Mso::ActiveObject<IReactInstanceInternal>
|
|
|
205
205
|
|
|
206
206
|
#ifdef USE_FABRIC
|
|
207
207
|
// Bridgeless
|
|
208
|
-
std::
|
|
208
|
+
std::shared_ptr<facebook::react::ReactInstance> m_bridgelessReactInstance;
|
|
209
209
|
#endif
|
|
210
210
|
|
|
211
211
|
std::atomic<ReactInstanceState> m_state{ReactInstanceState::Loading};
|
|
@@ -5,14 +5,19 @@
|
|
|
5
5
|
#include "ReactRootView.g.cpp"
|
|
6
6
|
|
|
7
7
|
#include <QuirkSettings.h>
|
|
8
|
+
#include <ReactHost/DebuggerNotifications.h>
|
|
8
9
|
#include <ReactHost/MsoUtils.h>
|
|
10
|
+
#include <UI.Text.h>
|
|
11
|
+
#include <UI.Xaml.Controls.Primitives.h>
|
|
9
12
|
#include <UI.Xaml.Input.h>
|
|
10
13
|
#include <UI.Xaml.Media.Media3D.h>
|
|
11
14
|
#include <Utils/Helpers.h>
|
|
12
15
|
#include <dispatchQueue/dispatchQueue.h>
|
|
13
16
|
#include <winrt/Windows.UI.Core.h>
|
|
17
|
+
#include "InstanceManager.h"
|
|
14
18
|
#include "ReactNativeHost.h"
|
|
15
19
|
#include "ReactViewInstance.h"
|
|
20
|
+
#include "Utils/KeyboardUtils.h"
|
|
16
21
|
#include "XamlUtils.h"
|
|
17
22
|
|
|
18
23
|
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
|
@@ -34,6 +39,7 @@ ReactRootView::ReactRootView() noexcept : m_uiQueue(Mso::DispatchQueue::GetCurre
|
|
|
34
39
|
UpdatePerspective();
|
|
35
40
|
Loaded([this](auto &&, auto &&) {
|
|
36
41
|
::Microsoft::ReactNative::SetCompositor(::Microsoft::ReactNative::GetCompositor(*this));
|
|
42
|
+
SetupDevToolsShortcut();
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
45
|
|
|
@@ -45,6 +51,20 @@ void ReactRootView::ReactNativeHost(ReactNative::ReactNativeHost const &value) n
|
|
|
45
51
|
if (m_reactNativeHost != value) {
|
|
46
52
|
ReactViewHost(nullptr);
|
|
47
53
|
m_reactNativeHost = value;
|
|
54
|
+
const auto weakThis = this->get_weak();
|
|
55
|
+
::Microsoft::ReactNative::DebuggerNotifications::SubscribeShowDebuggerPausedOverlay(
|
|
56
|
+
m_reactNativeHost.InstanceSettings().Notifications(),
|
|
57
|
+
m_reactNativeHost.InstanceSettings().UIDispatcher(),
|
|
58
|
+
[weakThis](std::string message, std::function<void()> onResume) {
|
|
59
|
+
if (auto strongThis = weakThis.get()) {
|
|
60
|
+
strongThis->ShowDebuggerPausedOverlay(message, onResume);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
[weakThis]() {
|
|
64
|
+
if (auto strongThis = weakThis.get()) {
|
|
65
|
+
strongThis->HideDebuggerPausedOverlay();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
48
68
|
ReloadView();
|
|
49
69
|
}
|
|
50
70
|
}
|
|
@@ -283,6 +303,65 @@ void ReactRootView::EnsureLoadingUI() noexcept {
|
|
|
283
303
|
}
|
|
284
304
|
}
|
|
285
305
|
|
|
306
|
+
void ReactRootView::HideDebuggerPausedOverlay() noexcept {
|
|
307
|
+
m_isDebuggerPausedOverlayOpen = false;
|
|
308
|
+
if (m_debuggerPausedFlyout) {
|
|
309
|
+
m_debuggerPausedFlyout.Hide();
|
|
310
|
+
m_debuggerPausedFlyout = nullptr;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
void ReactRootView::ShowDebuggerPausedOverlay(
|
|
315
|
+
const std::string &message,
|
|
316
|
+
const std::function<void()> &onResume) noexcept {
|
|
317
|
+
// Initialize content
|
|
318
|
+
const xaml::Controls::Grid contentGrid;
|
|
319
|
+
xaml::Controls::ColumnDefinition messageColumnDefinition;
|
|
320
|
+
xaml::Controls::ColumnDefinition buttonColumnDefinition;
|
|
321
|
+
messageColumnDefinition.MinWidth(60);
|
|
322
|
+
buttonColumnDefinition.MinWidth(36);
|
|
323
|
+
contentGrid.ColumnDefinitions().Append(messageColumnDefinition);
|
|
324
|
+
contentGrid.ColumnDefinitions().Append(buttonColumnDefinition);
|
|
325
|
+
xaml::Controls::TextBlock messageBlock;
|
|
326
|
+
messageBlock.Text(winrt::to_hstring(message));
|
|
327
|
+
messageBlock.FontWeight(winrt::Windows::UI::Text::FontWeights::SemiBold());
|
|
328
|
+
xaml::Controls::FontIcon resumeGlyph;
|
|
329
|
+
resumeGlyph.FontFamily(xaml::Media::FontFamily(L"Segoe MDL2 Assets"));
|
|
330
|
+
resumeGlyph.Foreground(xaml::Media::SolidColorBrush(winrt::Colors::Green()));
|
|
331
|
+
resumeGlyph.Glyph(L"\uF5B0");
|
|
332
|
+
resumeGlyph.HorizontalAlignment(xaml::HorizontalAlignment::Right);
|
|
333
|
+
resumeGlyph.PointerReleased([onResume](auto &&...) { onResume(); });
|
|
334
|
+
xaml::Controls::Grid::SetColumn(resumeGlyph, 1);
|
|
335
|
+
contentGrid.Children().Append(messageBlock);
|
|
336
|
+
contentGrid.Children().Append(resumeGlyph);
|
|
337
|
+
|
|
338
|
+
// Configure flyout
|
|
339
|
+
m_isDebuggerPausedOverlayOpen = true;
|
|
340
|
+
xaml::Style flyoutStyle(
|
|
341
|
+
{XAML_NAMESPACE_STR L".Controls.FlyoutPresenter", winrt::Windows::UI::Xaml::Interop::TypeKind::Metadata});
|
|
342
|
+
flyoutStyle.Setters().Append(winrt::Setter(
|
|
343
|
+
xaml::Controls::Control::CornerRadiusProperty(), winrt::box_value(xaml::CornerRadius{12, 12, 12, 12})));
|
|
344
|
+
flyoutStyle.Setters().Append(winrt::Setter(
|
|
345
|
+
xaml::Controls::Control::BackgroundProperty(),
|
|
346
|
+
winrt::box_value(xaml::Media::SolidColorBrush{FromArgb(255, 255, 255, 193)})));
|
|
347
|
+
flyoutStyle.Setters().Append(
|
|
348
|
+
winrt::Setter(xaml::FrameworkElement::MarginProperty(), winrt::box_value(xaml::Thickness{0, 12, 0, 0})));
|
|
349
|
+
m_debuggerPausedFlyout = xaml::Controls::Flyout{};
|
|
350
|
+
m_debuggerPausedFlyout.FlyoutPresenterStyle(flyoutStyle);
|
|
351
|
+
m_debuggerPausedFlyout.LightDismissOverlayMode(xaml::Controls::LightDismissOverlayMode::On);
|
|
352
|
+
m_debuggerPausedFlyout.Content(contentGrid);
|
|
353
|
+
|
|
354
|
+
// Disable light dismiss
|
|
355
|
+
m_debuggerPausedFlyout.Closing([weakThis = this->get_weak()](auto &&, const auto &args) {
|
|
356
|
+
if (auto strongThis = weakThis.get()) {
|
|
357
|
+
args.Cancel(strongThis->m_isDebuggerPausedOverlayOpen);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// Show flyout
|
|
362
|
+
m_debuggerPausedFlyout.ShowAt(*this);
|
|
363
|
+
}
|
|
364
|
+
|
|
286
365
|
void ReactRootView::ShowInstanceLoaded() noexcept {
|
|
287
366
|
if (m_xamlRootView) {
|
|
288
367
|
ClearLoadingUI();
|
|
@@ -481,4 +560,33 @@ void ReactRootView::RemoveChildAt(uint32_t index) {
|
|
|
481
560
|
Children().RemoveAt(RNIndexToXamlIndex(index));
|
|
482
561
|
}
|
|
483
562
|
|
|
563
|
+
bool IsCtrlShiftI(winrt::Windows::System::VirtualKey key) noexcept {
|
|
564
|
+
return (
|
|
565
|
+
key == winrt::Windows::System::VirtualKey::I &&
|
|
566
|
+
::Microsoft::ReactNative::IsModifiedKeyPressed(
|
|
567
|
+
winrt::CoreWindow::GetForCurrentThread(), winrt::Windows::System::VirtualKey::Shift) &&
|
|
568
|
+
::Microsoft::ReactNative::IsModifiedKeyPressed(
|
|
569
|
+
winrt::CoreWindow::GetForCurrentThread(), winrt::Windows::System::VirtualKey::Control));
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
void ReactRootView::SetupDevToolsShortcut() noexcept {
|
|
573
|
+
if (auto xamlRoot = XamlRoot()) {
|
|
574
|
+
if (std::find(m_subscribedDebuggerRoots.begin(), m_subscribedDebuggerRoots.end(), xamlRoot) ==
|
|
575
|
+
m_subscribedDebuggerRoots.end()) {
|
|
576
|
+
if (auto rootContent = xamlRoot.Content()) {
|
|
577
|
+
m_subscribedDebuggerRoots.push_back(xamlRoot);
|
|
578
|
+
rootContent.KeyDown(
|
|
579
|
+
[weakThis = this->get_weak()](const auto & /*sender*/, const xaml::Input::KeyRoutedEventArgs &args) {
|
|
580
|
+
if (const auto strongThis = weakThis.get()) {
|
|
581
|
+
if (IsCtrlShiftI(args.Key())) {
|
|
582
|
+
::Microsoft::ReactNative::GetSharedDevManager()->OpenDevTools(
|
|
583
|
+
winrt::to_string(strongThis->m_reactNativeHost.InstanceSettings().BundleAppId()));
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
484
592
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -72,6 +72,7 @@ struct ReactRootView : ReactRootViewT<ReactRootView>, ::Microsoft::ReactNative::
|
|
|
72
72
|
bool m_isPerspectiveEnabled{true};
|
|
73
73
|
bool m_isInitialized{false};
|
|
74
74
|
bool m_isJSViewAttached{false};
|
|
75
|
+
bool m_isDebuggerPausedOverlayOpen{false};
|
|
75
76
|
Mso::DispatchQueue m_uiQueue;
|
|
76
77
|
int64_t m_rootTag{-1};
|
|
77
78
|
std::unique_ptr<Mso::React::ReactOptions> m_reactOptions;
|
|
@@ -84,9 +85,11 @@ struct ReactRootView : ReactRootViewT<ReactRootView>, ::Microsoft::ReactNative::
|
|
|
84
85
|
std::shared_ptr<::Microsoft::ReactNative::PreviewKeyboardEventHandlerOnRoot> m_previewKeyboardEventHandlerOnRoot;
|
|
85
86
|
xaml::Controls::ContentControl m_focusSafeHarbor{nullptr};
|
|
86
87
|
xaml::Controls::ContentControl::LosingFocus_revoker m_focusSafeHarborLosingFocusRevoker{};
|
|
88
|
+
xaml::Controls::Flyout m_debuggerPausedFlyout{nullptr};
|
|
87
89
|
winrt::Grid m_greenBoxGrid{nullptr};
|
|
88
90
|
winrt::TextBlock m_waitingTextBlock{nullptr};
|
|
89
91
|
winrt::SystemNavigationManager::BackRequested_revoker m_backRequestedRevoker{};
|
|
92
|
+
std::vector<xaml::XamlRoot> m_subscribedDebuggerRoots{};
|
|
90
93
|
|
|
91
94
|
// Visual tree to support safe harbor
|
|
92
95
|
// this
|
|
@@ -102,6 +105,8 @@ struct ReactRootView : ReactRootViewT<ReactRootView>, ::Microsoft::ReactNative::
|
|
|
102
105
|
void UpdateRootViewInternal() noexcept;
|
|
103
106
|
void ClearLoadingUI() noexcept;
|
|
104
107
|
void EnsureLoadingUI() noexcept;
|
|
108
|
+
void HideDebuggerPausedOverlay() noexcept;
|
|
109
|
+
void ShowDebuggerPausedOverlay(const std::string &message, const std::function<void()> &onResume) noexcept;
|
|
105
110
|
void ShowInstanceLoaded() noexcept;
|
|
106
111
|
void ShowInstanceError() noexcept;
|
|
107
112
|
void ShowInstanceWaiting() noexcept;
|
|
@@ -112,6 +117,7 @@ struct ReactRootView : ReactRootViewT<ReactRootView>, ::Microsoft::ReactNative::
|
|
|
112
117
|
bool OnBackRequested() noexcept;
|
|
113
118
|
Mso::React::IReactViewHost *ReactViewHost() noexcept;
|
|
114
119
|
void ReactViewHost(Mso::React::IReactViewHost *viewHost) noexcept;
|
|
120
|
+
void SetupDevToolsShortcut() noexcept;
|
|
115
121
|
};
|
|
116
122
|
|
|
117
123
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<!-- If your project is using glog, then GLog_IncludeDir could be set to include the actual location of glog -->
|
|
15
15
|
<GLog_IncludeDir Condition="'$(GLog_IncludeDir)' == '' AND Exists('$(MSBuildThisFileDirectory)stubs\glog\logging.h')">$(MSBuildThisFileDirectory)stubs</GLog_IncludeDir>
|
|
16
16
|
|
|
17
|
-
<NodeApiJsiCommitHash>
|
|
17
|
+
<NodeApiJsiCommitHash>21b47f08b762b21b1d4d970940ab23f59f43249c</NodeApiJsiCommitHash>
|
|
18
18
|
<NodeApiJsiLocal Condition="Exists('$(MSBuildThisFileDirectory)NodeApiJsiRuntime.cpp')">true</NodeApiJsiLocal>
|
|
19
19
|
<NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(NodeApiJsiLocal)' == 'true'">$(MSBuildThisFileDirectory)</NodeApiJsiDir>
|
|
20
20
|
<NodeApiJsiDir Condition="'$(NodeApiJsiDir)' == '' AND '$(ReactNativeDir)' != ''">$(ReactNativeDir)\..\..\node_modules\.node-api-jsi\node-api-jsi-$(NodeApiJsiCommitHash)\</NodeApiJsiDir>
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
-->
|
|
11
11
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
12
12
|
<PropertyGroup>
|
|
13
|
-
<ReactNativeWindowsVersion>0.80.
|
|
13
|
+
<ReactNativeWindowsVersion>0.80.5</ReactNativeWindowsVersion>
|
|
14
14
|
<ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
|
|
15
15
|
<ReactNativeWindowsMinor>80</ReactNativeWindowsMinor>
|
|
16
|
-
<ReactNativeWindowsPatch>
|
|
16
|
+
<ReactNativeWindowsPatch>5</ReactNativeWindowsPatch>
|
|
17
17
|
<ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
|
|
18
|
-
<ReactNativeWindowsCommitId>
|
|
18
|
+
<ReactNativeWindowsCommitId>2f4935ac69841dfca983dd947ce93d4a11e04c8d</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-
|
|
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>
|
|
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
|
|
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::
|
|
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::
|
|
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::
|
|
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::
|
|
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
|
-
|
|
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
|
-
|
|
295
|
-
return
|
|
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;
|
|
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
|
|
@@ -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
|