react-native 0.74.0-nightly-20240220-e9351f0f8 → 0.74.0-rc.0

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 (41) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/React/Base/RCTBridge+Private.h +2 -2
  3. package/React/Base/RCTBridge.mm +7 -7
  4. package/React/Base/RCTVersion.m +1 -1
  5. package/React/CxxBridge/RCTCxxBridge.mm +3 -3
  6. package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +2 -2
  7. package/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp +2 -10
  8. package/ReactAndroid/gradle.properties +1 -1
  9. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +0 -4
  10. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  11. package/ReactCommon/cxxreact/Instance.cpp +1 -1
  12. package/ReactCommon/cxxreact/Instance.h +2 -2
  13. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  14. package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.cpp +2 -2
  15. package/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegate.h +1 -1
  16. package/ReactCommon/jsinspector-modern/CONCEPTS.md +2 -2
  17. package/ReactCommon/jsinspector-modern/InstanceAgent.h +1 -1
  18. package/ReactCommon/jsinspector-modern/InstanceTarget.cpp +1 -1
  19. package/ReactCommon/jsinspector-modern/{HostAgent.cpp → PageAgent.cpp} +9 -9
  20. package/ReactCommon/jsinspector-modern/{HostAgent.h → PageAgent.h} +13 -13
  21. package/ReactCommon/jsinspector-modern/{HostTarget.cpp → PageTarget.cpp} +34 -34
  22. package/ReactCommon/jsinspector-modern/{HostTarget.h → PageTarget.h} +52 -52
  23. package/ReactCommon/jsinspector-modern/ReactCdp.h +1 -1
  24. package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +1 -1
  25. package/ReactCommon/jsinspector-modern/RuntimeAgent.h +1 -1
  26. package/ReactCommon/jsinspector-modern/RuntimeTarget.h +4 -4
  27. package/ReactCommon/jsinspector-modern/tests/InspectorMocks.h +2 -2
  28. package/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +5 -5
  29. package/ReactCommon/jsinspector-modern/tests/{HostTargetTest.cpp → PageTargetTest.cpp} +33 -33
  30. package/ReactCommon/react/runtime/ReactInstance.cpp +1 -1
  31. package/ReactCommon/react/runtime/ReactInstance.h +2 -2
  32. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +6 -6
  33. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +1 -1
  34. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +2 -2
  35. package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.mm +1 -1
  36. package/package.json +8 -8
  37. package/sdks/.hermesversion +1 -0
  38. package/sdks/hermesc/osx-bin/hermes +0 -0
  39. package/sdks/hermesc/osx-bin/hermesc +0 -0
  40. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  41. package/template/package.json +5 -5
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 74,
19
19
  patch: 0,
20
- prerelease: 'nightly-20240220-e9351f0f8',
20
+ prerelease: 'rc.0',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -74,11 +74,11 @@ RCT_EXTERN void RCTRegisterModule(Class);
74
74
  @property (nonatomic, strong, readonly) RCTModuleRegistry *moduleRegistry;
75
75
 
76
76
  /**
77
- * The HostTarget for this bridge, if one has been created. Exposed for RCTCxxBridge only.
77
+ * The page target for this bridge, if one has been created. Exposed for RCTCxxBridge only.
78
78
  */
79
79
  @property (nonatomic, assign, readonly)
80
80
  #ifdef __cplusplus
81
- facebook::react::jsinspector_modern::HostTarget *
81
+ facebook::react::jsinspector_modern::PageTarget *
82
82
  #else
83
83
  // The inspector infrastructure cannot be used in C code.
84
84
  void *
@@ -188,9 +188,9 @@ void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled)
188
188
  kDispatchAccessibilityManagerInitOntoMain = enabled;
189
189
  }
190
190
 
191
- class RCTBridgeHostTargetDelegate : public facebook::react::jsinspector_modern::HostTargetDelegate {
191
+ class RCTBridgePageTargetDelegate : public facebook::react::jsinspector_modern::PageTargetDelegate {
192
192
  public:
193
- RCTBridgeHostTargetDelegate(RCTBridge *bridge) : bridge_(bridge) {}
193
+ RCTBridgePageTargetDelegate(RCTBridge *bridge) : bridge_(bridge) {}
194
194
 
195
195
  void onReload(const PageReloadRequest &request) override
196
196
  {
@@ -208,8 +208,8 @@ class RCTBridgeHostTargetDelegate : public facebook::react::jsinspector_modern::
208
208
  @implementation RCTBridge {
209
209
  NSURL *_delegateBundleURL;
210
210
 
211
- std::unique_ptr<RCTBridgeHostTargetDelegate> _inspectorHostDelegate;
212
- std::shared_ptr<facebook::react::jsinspector_modern::HostTarget> _inspectorTarget;
211
+ std::unique_ptr<RCTBridgePageTargetDelegate> _inspectorPageDelegate;
212
+ std::shared_ptr<facebook::react::jsinspector_modern::PageTarget> _inspectorTarget;
213
213
  std::optional<int> _inspectorPageId;
214
214
  }
215
215
 
@@ -259,7 +259,7 @@ static RCTBridge *RCTCurrentBridgeInstance = nil;
259
259
  _bundleURL = bundleURL;
260
260
  _moduleProvider = block;
261
261
  _launchOptions = [launchOptions copy];
262
- _inspectorHostDelegate = std::make_unique<RCTBridgeHostTargetDelegate>(self);
262
+ _inspectorPageDelegate = std::make_unique<RCTBridgePageTargetDelegate>(self);
263
263
 
264
264
  [self setUp];
265
265
  }
@@ -413,7 +413,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
413
413
  auto &inspectorFlags = facebook::react::jsinspector_modern::InspectorFlags::getInstance();
414
414
  if (inspectorFlags.getEnableModernCDPRegistry() && !_inspectorPageId.has_value()) {
415
415
  _inspectorTarget =
416
- facebook::react::jsinspector_modern::HostTarget::create(*_inspectorHostDelegate, [](auto callback) {
416
+ facebook::react::jsinspector_modern::PageTarget::create(*_inspectorPageDelegate, [](auto callback) {
417
417
  RCTExecuteOnMainQueue(^{
418
418
  callback();
419
419
  });
@@ -526,7 +526,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
526
526
  [self.batchedBridge registerSegmentWithId:segmentId path:path];
527
527
  }
528
528
 
529
- - (facebook::react::jsinspector_modern::HostTarget *)inspectorTarget
529
+ - (facebook::react::jsinspector_modern::PageTarget *)inspectorTarget
530
530
  {
531
531
  return _inspectorTarget.get();
532
532
  }
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"nightly-20240220-e9351f0f8",
27
+ RCTVersionPrerelease: @"rc.0",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -437,7 +437,7 @@ struct RCTInstanceCallback : public InstanceCallback {
437
437
  // pointer into a member of RCTBridge! But we only use it while _reactInstance exists, meaning we
438
438
  // haven't been invalidated, and therefore RCTBridge hasn't been deallocated yet.
439
439
  RCTAssertMainQueue();
440
- facebook::react::jsinspector_modern::HostTarget *parentInspectorTarget = _parentBridge.inspectorTarget;
440
+ facebook::react::jsinspector_modern::PageTarget *parentInspectorTarget = _parentBridge.inspectorTarget;
441
441
 
442
442
  // Dispatch the instance initialization as soon as the initial module metadata has
443
443
  // been collected (see initModules)
@@ -658,7 +658,7 @@ struct RCTInstanceCallback : public InstanceCallback {
658
658
  }
659
659
 
660
660
  - (void)_initializeBridge:(std::shared_ptr<JSExecutorFactory>)executorFactory
661
- parentInspectorTarget:(facebook::react::jsinspector_modern::HostTarget *)parentInspectorTarget
661
+ parentInspectorTarget:(facebook::react::jsinspector_modern::PageTarget *)parentInspectorTarget
662
662
  {
663
663
  if (!self.valid) {
664
664
  return;
@@ -691,7 +691,7 @@ struct RCTInstanceCallback : public InstanceCallback {
691
691
  }
692
692
 
693
693
  - (void)_initializeBridgeLocked:(std::shared_ptr<JSExecutorFactory>)executorFactory
694
- parentInspectorTarget:(facebook::react::jsinspector_modern::HostTarget *)parentInspectorTarget
694
+ parentInspectorTarget:(facebook::react::jsinspector_modern::PageTarget *)parentInspectorTarget
695
695
  {
696
696
  std::lock_guard<std::mutex> guard(_moduleRegistryLock);
697
697
 
@@ -179,8 +179,8 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index";
179
179
 
180
180
  - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
181
181
  {
182
- if (_adapter && index < _adapter.paperView.reactSubviews.count) {
183
- [_adapter.paperView removeReactSubview:_adapter.paperView.reactSubviews[index]];
182
+ if (_adapter) {
183
+ [_adapter.paperView removeReactSubview:childComponentView];
184
184
  } else {
185
185
  [_viewsToBeUnmounted addObject:childComponentView];
186
186
  }
@@ -62,16 +62,8 @@ void registerComponents(
62
62
  std::shared_ptr<TurboModule> cxxModuleProvider(
63
63
  const std::string& name,
64
64
  const std::shared_ptr<CallInvoker>& jsInvoker) {
65
- // Here you can provide your CXX Turbo Modules coming from
66
- // either your application or from external libraries. The approach to follow
67
- // is similar to the following (for a module called `NativeCxxModuleExample`):
68
- //
69
- // if (name == NativeCxxModuleExample::kModuleName) {
70
- // return std::make_shared<NativeCxxModuleExample>(jsInvoker);
71
- // }
72
-
73
- // And we fallback to the CXX module providers autolinked by RN CLI
74
- return rncli_cxxModuleProvider(name, jsInvoker);
65
+ // Not implemented yet: provide pure-C++ NativeModules here.
66
+ return nullptr;
75
67
  }
76
68
 
77
69
  std::shared_ptr<TurboModule> javaModuleProvider(
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.0-nightly-20240220-e9351f0f8
1
+ VERSION_NAME=0.74.0-rc.0
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -1231,10 +1231,6 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
1231
1231
  public void run() {
1232
1232
  mMountNotificationScheduled.set(false);
1233
1233
 
1234
- if (mDestroyed) {
1235
- return;
1236
- }
1237
-
1238
1234
  final @Nullable Binding binding = mBinding;
1239
1235
  if (mountItems == null || binding == null) {
1240
1236
  return;
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 74,
20
20
  "patch", 0,
21
- "prerelease", "nightly-20240220-e9351f0f8");
21
+ "prerelease", "rc.0");
22
22
  }
@@ -54,7 +54,7 @@ void Instance::initializeBridge(
54
54
  std::shared_ptr<JSExecutorFactory> jsef,
55
55
  std::shared_ptr<MessageQueueThread> jsQueue,
56
56
  std::shared_ptr<ModuleRegistry> moduleRegistry,
57
- jsinspector_modern::HostTarget* parentInspectorTarget) {
57
+ jsinspector_modern::PageTarget* parentInspectorTarget) {
58
58
  callback_ = std::move(callback);
59
59
  moduleRegistry_ = std::move(moduleRegistry);
60
60
  parentInspectorTarget_ = parentInspectorTarget;
@@ -47,7 +47,7 @@ class RN_EXPORT Instance : private jsinspector_modern::InstanceTargetDelegate {
47
47
  std::shared_ptr<JSExecutorFactory> jsef,
48
48
  std::shared_ptr<MessageQueueThread> jsQueue,
49
49
  std::shared_ptr<ModuleRegistry> moduleRegistry,
50
- jsinspector_modern::HostTarget* inspectorTarget = nullptr);
50
+ jsinspector_modern::PageTarget* inspectorTarget = nullptr);
51
51
 
52
52
  void initializeRuntime();
53
53
 
@@ -178,7 +178,7 @@ class RN_EXPORT Instance : private jsinspector_modern::InstanceTargetDelegate {
178
178
  std::shared_ptr<JSCallInvoker> jsCallInvoker_ =
179
179
  std::make_shared<JSCallInvoker>();
180
180
 
181
- jsinspector_modern::HostTarget* parentInspectorTarget_{nullptr};
181
+ jsinspector_modern::PageTarget* parentInspectorTarget_{nullptr};
182
182
  jsinspector_modern::InstanceTarget* inspectorTarget_{nullptr};
183
183
  jsinspector_modern::RuntimeTarget* runtimeInspectorTarget_{nullptr};
184
184
  };
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 74;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "nightly-20240220-e9351f0f8";
21
+ std::string_view Prerelease = "rc.0";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -102,7 +102,7 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate {
102
102
  * \param executionContextDescription A description of the execution context
103
103
  * represented by this runtime. This is used for disambiguating the
104
104
  * source/destination of CDP messages when there are multiple runtimes
105
- * (concurrently or over the life of a Host).
105
+ * (concurrently or over the life of a Page).
106
106
  * \param runtime The HermesRuntime that this agent is attached to.
107
107
  * \param runtimeExecutor A callback for scheduling work on the JS thread.
108
108
  * \c runtimeExecutor may drop scheduled work if the runtime is destroyed
@@ -155,7 +155,7 @@ class HermesRuntimeAgentDelegate::Impl final : public RuntimeAgentDelegate {
155
155
  // TODO: Change to string::starts_with when we're on C++20.
156
156
  if (req.method.rfind("Log.", 0) == 0) {
157
157
  // Since we know Hermes doesn't do anything useful with Log messages, but
158
- // our containing HostAgent will, just bail out early.
158
+ // our containing PageAgent will, just bail out early.
159
159
  // TODO: We need a way to negotiate this more dynamically with Hermes
160
160
  // through the API.
161
161
  return false;
@@ -33,7 +33,7 @@ class HermesRuntimeAgentDelegate : public RuntimeAgentDelegate {
33
33
  * \param executionContextDescription A description of the execution context
34
34
  * represented by this runtime. This is used for disambiguating the
35
35
  * source/destination of CDP messages when there are multiple runtimes
36
- * (concurrently or over the life of a Host).
36
+ * (concurrently or over the life of a Page).
37
37
  * \param runtime The HermesRuntime that this agent is attached to.
38
38
  * \param runtimeExecutor A callback for scheduling work on the JS thread.
39
39
  * \c runtimeExecutor may drop scheduled work if the runtime is destroyed
@@ -8,11 +8,11 @@ A debuggable entity that a debugger frontend can connect to.
8
8
 
9
9
  ### Target Delegate
10
10
 
11
- An interface between a Target class and the underlying debuggable entity. For example, HostTargetDelegate is used by HostTarget to send host-related events to the native platform implementation.
11
+ An interface between a Target class and the underlying debuggable entity. For example, PageTargetDelegate is used by PageTarget to send page-related events to the native platform implementation.
12
12
 
13
13
  ### Target Controller
14
14
 
15
- A private interface exposed by a Target class to its Sessions/Agents. For example, HostTargetController is used by HostAgent to safely access the host's HostTargetDelegate, without exposing HostTarget's other private state.
15
+ A private interface exposed by a Target class to its Sessions/Agents. For example, PageTargetController is used by PageAgent to safely access the page's PageTargetDelegate, without exposing PageTarget's other private state.
16
16
 
17
17
  ### Session
18
18
 
@@ -47,7 +47,7 @@ class InstanceAgent final {
47
47
  bool handleRequest(const cdp::PreparsedRequest& req);
48
48
 
49
49
  /**
50
- * Replace the current RuntimeAgent hostAgent_ with a new one
50
+ * Replace the current RuntimeAgent pageAgent_ with a new one
51
51
  * connected to the new RuntimeTarget.
52
52
  * \param runtime The new runtime target. May be nullptr to indicate
53
53
  * there's no current debuggable runtime.
@@ -47,7 +47,7 @@ InstanceTarget::~InstanceTarget() {
47
47
  // they hold an InstanceTarget& that we must guarantee is valid.
48
48
  assert(
49
49
  agents_.empty() &&
50
- "InstanceAgent objects must be destroyed before their InstanceTarget. Did you call HostTarget::unregisterInstance()?");
50
+ "InstanceAgent objects must be destroyed before their InstanceTarget. Did you call PageTarget::unregisterInstance()?");
51
51
  }
52
52
 
53
53
  RuntimeTarget& InstanceTarget::registerRuntime(
@@ -7,9 +7,9 @@
7
7
 
8
8
  #include <folly/dynamic.h>
9
9
  #include <folly/json.h>
10
- #include <jsinspector-modern/HostAgent.h>
11
- #include <jsinspector-modern/HostTarget.h>
12
10
  #include <jsinspector-modern/InstanceAgent.h>
11
+ #include <jsinspector-modern/PageAgent.h>
12
+ #include <jsinspector-modern/PageTarget.h>
13
13
 
14
14
  #include <chrono>
15
15
 
@@ -27,19 +27,19 @@ namespace facebook::react::jsinspector_modern {
27
27
  static constexpr auto kModernCDPBackendNotice =
28
28
  ANSI_COLOR_BG_YELLOW ANSI_WEIGHT_BOLD
29
29
  "NOTE:" ANSI_WEIGHT_RESET " You are using the " ANSI_STYLE_ITALIC
30
- "modern" ANSI_STYLE_RESET " CDP backend for React Native (HostTarget)."sv;
30
+ "modern" ANSI_STYLE_RESET " CDP backend for React Native (PageTarget)."sv;
31
31
 
32
- HostAgent::HostAgent(
32
+ PageAgent::PageAgent(
33
33
  FrontendChannel frontendChannel,
34
- HostTargetController& targetController,
35
- HostTarget::SessionMetadata sessionMetadata,
34
+ PageTargetController& targetController,
35
+ PageTarget::SessionMetadata sessionMetadata,
36
36
  SessionState& sessionState)
37
37
  : frontendChannel_(frontendChannel),
38
38
  targetController_(targetController),
39
39
  sessionMetadata_(std::move(sessionMetadata)),
40
40
  sessionState_(sessionState) {}
41
41
 
42
- void HostAgent::handleRequest(const cdp::PreparsedRequest& req) {
42
+ void PageAgent::handleRequest(const cdp::PreparsedRequest& req) {
43
43
  bool shouldSendOKResponse = false;
44
44
  bool isFinishedHandlingRequest = false;
45
45
 
@@ -113,7 +113,7 @@ void HostAgent::handleRequest(const cdp::PreparsedRequest& req) {
113
113
  frontendChannel_(json);
114
114
  }
115
115
 
116
- void HostAgent::sendInfoLogEntry(std::string_view text) {
116
+ void PageAgent::sendInfoLogEntry(std::string_view text) {
117
117
  frontendChannel_(
118
118
  folly::toJson(folly::dynamic::object("method", "Log.entryAdded")(
119
119
  "params",
@@ -127,7 +127,7 @@ void HostAgent::sendInfoLogEntry(std::string_view text) {
127
127
  "level", "info")("text", text)))));
128
128
  }
129
129
 
130
- void HostAgent::setCurrentInstanceAgent(
130
+ void PageAgent::setCurrentInstanceAgent(
131
131
  std::shared_ptr<InstanceAgent> instanceAgent) {
132
132
  auto previousInstanceAgent = std::move(instanceAgent_);
133
133
  instanceAgent_ = std::move(instanceAgent);
@@ -7,7 +7,7 @@
7
7
 
8
8
  #pragma once
9
9
 
10
- #include "HostTarget.h"
10
+ #include "PageTarget.h"
11
11
  #include "SessionState.h"
12
12
 
13
13
  #include <jsinspector-modern/InspectorInterfaces.h>
@@ -19,32 +19,32 @@
19
19
 
20
20
  namespace facebook::react::jsinspector_modern {
21
21
 
22
- class HostTarget;
22
+ class PageTarget;
23
23
  class InstanceAgent;
24
24
  class InstanceTarget;
25
25
 
26
26
  /**
27
27
  * An Agent that handles requests from the Chrome DevTools Protocol for the
28
- * given Host.
28
+ * given page.
29
29
  * The constructor, destructor and all public methods must be called on the
30
- * same thread, which is also the thread where the associated HostTarget is
30
+ * same thread, which is also the thread where the associated PageTarget is
31
31
  * constructed and managed.
32
32
  */
33
- class HostAgent final {
33
+ class PageAgent final {
34
34
  public:
35
35
  /**
36
36
  * \param frontendChannel A channel used to send responses and events to the
37
37
  * frontend.
38
- * \param targetController An interface to the HostTarget that this agent is
38
+ * \param targetController An interface to the PageTarget that this agent is
39
39
  * attached to. The caller is responsible for ensuring that the
40
- * HostTargetDelegate and underlying HostTarget both outlive the agent.
40
+ * PageTargetDelegate and underlying PageTarget both outlive the agent.
41
41
  * \param sessionMetadata Metadata about the session that created this agent.
42
42
  * \param sessionState The state of the session that created this agent.
43
43
  */
44
- HostAgent(
44
+ PageAgent(
45
45
  FrontendChannel frontendChannel,
46
- HostTargetController& targetController,
47
- HostTarget::SessionMetadata sessionMetadata,
46
+ PageTargetController& targetController,
47
+ PageTarget::SessionMetadata sessionMetadata,
48
48
  SessionState& sessionState);
49
49
 
50
50
  /**
@@ -70,13 +70,13 @@ class HostAgent final {
70
70
  * DevTools, the message will appear in the Console tab along with regular
71
71
  * console messages. The difference between Log.entryAdded and
72
72
  * Runtime.consoleAPICalled is that the latter requires an execution context
73
- * ID, which does not exist at the Host level.
73
+ * ID, which does not exist at the Page level.
74
74
  */
75
75
  void sendInfoLogEntry(std::string_view text);
76
76
 
77
77
  FrontendChannel frontendChannel_;
78
- HostTargetController& targetController_;
79
- const HostTarget::SessionMetadata sessionMetadata_;
78
+ PageTargetController& targetController_;
79
+ const PageTarget::SessionMetadata sessionMetadata_;
80
80
  std::shared_ptr<InstanceAgent> instanceAgent_;
81
81
 
82
82
  /**
@@ -5,11 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #include "HostTarget.h"
9
- #include "HostAgent.h"
8
+ #include "PageTarget.h"
10
9
  #include "InspectorInterfaces.h"
11
10
  #include "InspectorUtilities.h"
12
11
  #include "InstanceTarget.h"
12
+ #include "PageAgent.h"
13
13
  #include "Parsing.h"
14
14
  #include "SessionState.h"
15
15
 
@@ -21,15 +21,15 @@
21
21
  namespace facebook::react::jsinspector_modern {
22
22
 
23
23
  /**
24
- * A Session connected to a HostTarget, passing CDP messages to and from a
25
- * HostAgent which it owns.
24
+ * A Session connected to a PageTarget, passing CDP messages to and from a
25
+ * PageAgent which it owns.
26
26
  */
27
- class HostTargetSession {
27
+ class PageTargetSession {
28
28
  public:
29
- explicit HostTargetSession(
29
+ explicit PageTargetSession(
30
30
  std::unique_ptr<IRemoteConnection> remote,
31
- HostTargetController& targetController,
32
- HostTarget::SessionMetadata sessionMetadata)
31
+ PageTargetController& targetController,
32
+ PageTarget::SessionMetadata sessionMetadata)
33
33
  : remote_(std::make_shared<RAIIRemoteConnection>(std::move(remote))),
34
34
  frontendChannel_(
35
35
  [remoteWeak = std::weak_ptr(remote_)](std::string_view message) {
@@ -37,7 +37,7 @@ class HostTargetSession {
37
37
  remote->onMessage(std::string(message));
38
38
  }
39
39
  }),
40
- hostAgent_(
40
+ pageAgent_(
41
41
  frontendChannel_,
42
42
  targetController,
43
43
  std::move(sessionMetadata),
@@ -67,7 +67,7 @@ class HostTargetSession {
67
67
  // Catch exceptions that may arise from accessing dynamic params during
68
68
  // request handling.
69
69
  try {
70
- hostAgent_.handleRequest(request);
70
+ pageAgent_.handleRequest(request);
71
71
  } catch (const cdp::TypeError& e) {
72
72
  frontendChannel_(folly::toJson(folly::dynamic::object("id", request.id)(
73
73
  "error",
@@ -77,17 +77,17 @@ class HostTargetSession {
77
77
  }
78
78
 
79
79
  /**
80
- * Replace the current instance agent inside hostAgent_ with a new one
80
+ * Replace the current instance agent inside pageAgent_ with a new one
81
81
  * connected to the new InstanceTarget.
82
82
  * \param instance The new instance target. May be nullptr to indicate
83
83
  * there's no current instance.
84
84
  */
85
85
  void setCurrentInstance(InstanceTarget* instance) {
86
86
  if (instance) {
87
- hostAgent_.setCurrentInstanceAgent(
87
+ pageAgent_.setCurrentInstanceAgent(
88
88
  instance->createAgent(frontendChannel_, state_));
89
89
  } else {
90
- hostAgent_.setCurrentInstanceAgent(nullptr);
90
+ pageAgent_.setCurrentInstanceAgent(nullptr);
91
91
  }
92
92
  }
93
93
 
@@ -95,26 +95,26 @@ class HostTargetSession {
95
95
  // Owned by this instance, but shared (weakly) with the frontend channel
96
96
  std::shared_ptr<RAIIRemoteConnection> remote_;
97
97
  FrontendChannel frontendChannel_;
98
- HostAgent hostAgent_;
98
+ PageAgent pageAgent_;
99
99
  SessionState state_;
100
100
  };
101
101
 
102
- std::shared_ptr<HostTarget> HostTarget::create(
103
- HostTargetDelegate& delegate,
102
+ std::shared_ptr<PageTarget> PageTarget::create(
103
+ PageTargetDelegate& delegate,
104
104
  VoidExecutor executor) {
105
- std::shared_ptr<HostTarget> hostTarget{new HostTarget(delegate)};
106
- hostTarget->setExecutor(executor);
107
- return hostTarget;
105
+ std::shared_ptr<PageTarget> pageTarget{new PageTarget(delegate)};
106
+ pageTarget->setExecutor(executor);
107
+ return pageTarget;
108
108
  }
109
109
 
110
- HostTarget::HostTarget(HostTargetDelegate& delegate)
110
+ PageTarget::PageTarget(PageTargetDelegate& delegate)
111
111
  : delegate_(delegate),
112
112
  executionContextManager_{std::make_shared<ExecutionContextManager>()} {}
113
113
 
114
- std::unique_ptr<ILocalConnection> HostTarget::connect(
114
+ std::unique_ptr<ILocalConnection> PageTarget::connect(
115
115
  std::unique_ptr<IRemoteConnection> connectionToFrontend,
116
116
  SessionMetadata sessionMetadata) {
117
- auto session = std::make_shared<HostTargetSession>(
117
+ auto session = std::make_shared<PageTargetSession>(
118
118
  std::move(connectionToFrontend), controller_, std::move(sessionMetadata));
119
119
  session->setCurrentInstance(currentInstance_.get());
120
120
  sessions_.insert(std::weak_ptr(session));
@@ -122,44 +122,44 @@ std::unique_ptr<ILocalConnection> HostTarget::connect(
122
122
  [session](std::string message) { (*session)(message); });
123
123
  }
124
124
 
125
- HostTarget::~HostTarget() {
126
- // Sessions are owned by InspectorPackagerConnection, not by HostTarget, but
127
- // they hold a HostTarget& that we must guarantee is valid.
125
+ PageTarget::~PageTarget() {
126
+ // Sessions are owned by InspectorPackagerConnection, not by PageTarget, but
127
+ // they hold a PageTarget& that we must guarantee is valid.
128
128
  assert(
129
129
  sessions_.empty() &&
130
- "HostTargetSession objects must be destroyed before their HostTarget. Did you call getInspectorInstance().removePage()?");
130
+ "PageTargetSession objects must be destroyed before their PageTarget. Did you call getInspectorInstance().removePage()?");
131
131
  }
132
132
 
133
- HostTargetDelegate::~HostTargetDelegate() {}
133
+ PageTargetDelegate::~PageTargetDelegate() {}
134
134
 
135
- InstanceTarget& HostTarget::registerInstance(InstanceTargetDelegate& delegate) {
135
+ InstanceTarget& PageTarget::registerInstance(InstanceTargetDelegate& delegate) {
136
136
  assert(!currentInstance_ && "Only one instance allowed");
137
137
  currentInstance_ = InstanceTarget::create(
138
138
  executionContextManager_, delegate, makeVoidExecutor(executorFromThis()));
139
139
  sessions_.forEach(
140
- [currentInstance = &*currentInstance_](HostTargetSession& session) {
140
+ [currentInstance = &*currentInstance_](PageTargetSession& session) {
141
141
  session.setCurrentInstance(currentInstance);
142
142
  });
143
143
  return *currentInstance_;
144
144
  }
145
145
 
146
- void HostTarget::unregisterInstance(InstanceTarget& instance) {
146
+ void PageTarget::unregisterInstance(InstanceTarget& instance) {
147
147
  assert(
148
148
  currentInstance_ && currentInstance_.get() == &instance &&
149
149
  "Invalid unregistration");
150
150
  sessions_.forEach(
151
- [](HostTargetSession& session) { session.setCurrentInstance(nullptr); });
151
+ [](PageTargetSession& session) { session.setCurrentInstance(nullptr); });
152
152
  currentInstance_.reset();
153
153
  }
154
154
 
155
- HostTargetController::HostTargetController(HostTarget& target)
155
+ PageTargetController::PageTargetController(PageTarget& target)
156
156
  : target_(target) {}
157
157
 
158
- HostTargetDelegate& HostTargetController::getDelegate() {
158
+ PageTargetDelegate& PageTargetController::getDelegate() {
159
159
  return target_.getDelegate();
160
160
  }
161
161
 
162
- bool HostTargetController::hasInstance() const {
162
+ bool PageTargetController::hasInstance() const {
163
163
  return target_.hasInstance();
164
164
  }
165
165