File tree Expand file tree Collapse file tree 4 files changed +27
-8
lines changed
packages/react-native/ReactCommon
hermes/inspector-modern/chrome Expand file tree Collapse file tree 4 files changed +27
-8
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,9 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate {
72
72
}
73
73
74
74
bool handleRequest (const cdp::PreparsedRequest& req) override {
75
- // TODO: Change to string::starts_with when we're on C++20.
76
- if (req.method .rfind (" Log." , 0 ) == 0 ) {
77
- // Since we know Hermes doesn't do anything useful with Log messages,
78
- // but our containing HostAgent will, bail out early.
75
+ if (req.method .starts_with (" Log." ) || req.method .starts_with (" Network." )) {
76
+ // Since we know Hermes doesn't do anything useful with Log or Network
77
+ // messages, but our containing HostAgent will, bail out early.
79
78
// TODO: We need a way to negotiate this more dynamically with Hermes
80
79
// through the API.
81
80
return false ;
Original file line number Diff line number Diff line change 9
9
#include " InstanceAgent.h"
10
10
11
11
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
12
+ #include " InspectorFlags.h"
12
13
#include " NetworkIOAgent.h"
13
14
#include " SessionState.h"
14
15
#include " TracingAgent.h"
@@ -142,6 +143,24 @@ class HostAgent::Impl final {
142
143
.shouldSendOKResponse = true ,
143
144
};
144
145
}
146
+ if (InspectorFlags::getInstance ().getNetworkInspectionEnabled ()) {
147
+ if (req.method == " Network.enable" ) {
148
+ sessionState_.isNetworkDomainEnabled = true ;
149
+
150
+ return {
151
+ .isFinishedHandlingRequest = false ,
152
+ .shouldSendOKResponse = true ,
153
+ };
154
+ }
155
+ if (req.method == " Network.disable" ) {
156
+ sessionState_.isNetworkDomainEnabled = false ;
157
+
158
+ return {
159
+ .isFinishedHandlingRequest = false ,
160
+ .shouldSendOKResponse = true ,
161
+ };
162
+ }
163
+ }
145
164
146
165
// Methods other than domain enables/disables: handle anything we know how
147
166
// to handle, and delegate to the InstanceAgent otherwise. (In some special
Original file line number Diff line number Diff line change @@ -280,15 +280,15 @@ bool NetworkIOAgent::handleRequest(
280
280
if (req.method == " Network.enable" ) {
281
281
networkHandler.setFrontendChannel (frontendChannel_);
282
282
networkHandler.enable ();
283
- frontendChannel_ ( cdp::jsonResult (req. id ));
284
- return true ;
283
+ // NOTE: Domain enable/disable responses are sent by HostAgent.
284
+ return false ;
285
285
}
286
286
287
287
// @cdp Network.disable support is experimental.
288
288
if (req.method == " Network.disable" ) {
289
289
networkHandler.disable ();
290
- frontendChannel_ ( cdp::jsonResult (req. id ));
291
- return true ;
290
+ // NOTE: Domain enable/disable responses are sent by HostAgent.
291
+ return false ;
292
292
}
293
293
294
294
// @cdp Network.getResponseBody support is experimental.
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ struct SessionState {
24
24
bool isLogDomainEnabled{false };
25
25
bool isReactNativeApplicationDomainEnabled{false };
26
26
bool isRuntimeDomainEnabled{false };
27
+ bool isNetworkDomainEnabled{false };
27
28
28
29
/* *
29
30
* Whether the Trace Recording was initialized via CDP Tracing.start method
You can’t perform that action at this time.
0 commit comments