react-native-tvos 0.83.0-0rc0 → 0.83.0-0rc1
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/Libraries/Core/ReactNativeVersion.js +1 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/React-CoreModules.podspec +1 -0
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +8 -0
- package/React/Runtime/React-RCTRuntime.podspec +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
- package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -0
- package/ReactCommon/jsinspector-modern/HostAgent.cpp +33 -0
- package/ReactCommon/jsinspector-modern/HostAgent.h +6 -0
- package/ReactCommon/jsinspector-modern/HostTarget.h +5 -0
- package/ReactCommon/jsinspector-modern/InspectorFlags.cpp +6 -0
- package/ReactCommon/jsinspector-modern/InspectorFlags.h +7 -0
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp +37 -0
- package/ReactCommon/jsinspector-modern/InspectorInterfaces.h +12 -1
- package/ReactCommon/jsinspector-modern/TracingAgent.cpp +11 -1
- package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +4 -0
- package/ReactCommon/jsitooling/React-jsitooling.podspec +1 -0
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +48 -30
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
- package/ReactCommon/react/utils/React-utils.podspec +3 -1
- package/package.json +9 -8
- package/scripts/cocoapods/rncore.rb +20 -8
- package/scripts/cocoapods/rndependencies.rb +20 -6
- package/sdks/.hermesv1version +1 -0
- package/sdks/hermes-engine/hermes-utils.rb +18 -7
- package/sdks/hermes-engine/version.properties +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
|
@@ -29,7 +29,7 @@ export default class ReactNativeVersion {
|
|
|
29
29
|
static major: number = 0;
|
|
30
30
|
static minor: number = 83;
|
|
31
31
|
static patch: number = 0;
|
|
32
|
-
static prerelease: string | null = '
|
|
32
|
+
static prerelease: string | null = '0rc1';
|
|
33
33
|
|
|
34
34
|
static getVersionString(): string {
|
|
35
35
|
return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -61,6 +61,7 @@ Pod::Spec.new do |s|
|
|
|
61
61
|
add_dependency(s, "React-RCTFBReactNativeSpec")
|
|
62
62
|
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
|
|
63
63
|
add_dependency(s, "React-NativeModulesApple")
|
|
64
|
+
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
|
|
64
65
|
|
|
65
66
|
add_rn_third_party_dependencies(s)
|
|
66
67
|
add_rncore_dependency(s)
|
|
@@ -278,6 +278,7 @@ protected:
|
|
|
278
278
|
methodMap_["enableVirtualViewWindowFocusDetection"] = MethodMetadata {.argCount = 0, .invoker = __enableVirtualViewWindowFocusDetection};
|
|
279
279
|
methodMap_["enableWebPerformanceAPIsByDefault"] = MethodMetadata {.argCount = 0, .invoker = __enableWebPerformanceAPIsByDefault};
|
|
280
280
|
methodMap_["fixMappingOfEventPrioritiesBetweenFabricAndReact"] = MethodMetadata {.argCount = 0, .invoker = __fixMappingOfEventPrioritiesBetweenFabricAndReact};
|
|
281
|
+
methodMap_["fuseboxAssertSingleHostState"] = MethodMetadata {.argCount = 0, .invoker = __fuseboxAssertSingleHostState};
|
|
281
282
|
methodMap_["fuseboxEnabledRelease"] = MethodMetadata {.argCount = 0, .invoker = __fuseboxEnabledRelease};
|
|
282
283
|
methodMap_["fuseboxNetworkInspectionEnabled"] = MethodMetadata {.argCount = 0, .invoker = __fuseboxNetworkInspectionEnabled};
|
|
283
284
|
methodMap_["hideOffscreenVirtualViewsOnIOS"] = MethodMetadata {.argCount = 0, .invoker = __hideOffscreenVirtualViewsOnIOS};
|
|
@@ -695,6 +696,13 @@ private:
|
|
|
695
696
|
return bridging::callFromJs<bool>(rt, &T::fixMappingOfEventPrioritiesBetweenFabricAndReact, static_cast<NativeReactNativeFeatureFlagsCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
|
|
696
697
|
}
|
|
697
698
|
|
|
699
|
+
static jsi::Value __fuseboxAssertSingleHostState(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
|
|
700
|
+
static_assert(
|
|
701
|
+
bridging::getParameterCount(&T::fuseboxAssertSingleHostState) == 1,
|
|
702
|
+
"Expected fuseboxAssertSingleHostState(...) to have 1 parameters");
|
|
703
|
+
return bridging::callFromJs<bool>(rt, &T::fuseboxAssertSingleHostState, static_cast<NativeReactNativeFeatureFlagsCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
|
|
704
|
+
}
|
|
705
|
+
|
|
698
706
|
static jsi::Value __fuseboxEnabledRelease(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
|
|
699
707
|
static_assert(
|
|
700
708
|
bridging::getParameterCount(&T::fuseboxEnabledRelease) == 1,
|
|
@@ -56,6 +56,7 @@ Pod::Spec.new do |s|
|
|
|
56
56
|
|
|
57
57
|
add_dependency(s, "React-RuntimeCore")
|
|
58
58
|
add_dependency(s, "React-RuntimeApple")
|
|
59
|
+
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
|
|
59
60
|
|
|
60
61
|
if use_third_party_jsc()
|
|
61
62
|
s.exclude_files = ["RCTHermesInstanceFactory.{mm,h}", "RCTJscInstanceFactory.{mm,h}"]
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<09d1f1bdf5e156afcd7ce15f73ca1c3b>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -354,6 +354,12 @@ public object ReactNativeFeatureFlags {
|
|
|
354
354
|
@JvmStatic
|
|
355
355
|
public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = accessor.fixMappingOfEventPrioritiesBetweenFabricAndReact()
|
|
356
356
|
|
|
357
|
+
/**
|
|
358
|
+
* Enable system assertion validating that Fusebox is configured with a single host. When set, the CDP backend will dynamically disable features (Perf and Network) in the event that multiple hosts are registered (undefined behaviour), and broadcast this over `ReactNativeApplication.systemStateChanged`.
|
|
359
|
+
*/
|
|
360
|
+
@JvmStatic
|
|
361
|
+
public fun fuseboxAssertSingleHostState(): Boolean = accessor.fuseboxAssertSingleHostState()
|
|
362
|
+
|
|
357
363
|
/**
|
|
358
364
|
* Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in release builds. This flag is global and should not be changed across React Host lifetimes.
|
|
359
365
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<017aba8e549dc289c27bb4fa93e6d038>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -74,6 +74,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
74
74
|
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
|
|
75
75
|
private var enableWebPerformanceAPIsByDefaultCache: Boolean? = null
|
|
76
76
|
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
|
77
|
+
private var fuseboxAssertSingleHostStateCache: Boolean? = null
|
|
77
78
|
private var fuseboxEnabledReleaseCache: Boolean? = null
|
|
78
79
|
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
|
|
79
80
|
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
|
|
@@ -590,6 +591,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
590
591
|
return cached
|
|
591
592
|
}
|
|
592
593
|
|
|
594
|
+
override fun fuseboxAssertSingleHostState(): Boolean {
|
|
595
|
+
var cached = fuseboxAssertSingleHostStateCache
|
|
596
|
+
if (cached == null) {
|
|
597
|
+
cached = ReactNativeFeatureFlagsCxxInterop.fuseboxAssertSingleHostState()
|
|
598
|
+
fuseboxAssertSingleHostStateCache = cached
|
|
599
|
+
}
|
|
600
|
+
return cached
|
|
601
|
+
}
|
|
602
|
+
|
|
593
603
|
override fun fuseboxEnabledRelease(): Boolean {
|
|
594
604
|
var cached = fuseboxEnabledReleaseCache
|
|
595
605
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<278f3853a98e1dd72b66ad6168e11686>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -136,6 +136,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
136
136
|
|
|
137
137
|
@DoNotStrip @JvmStatic public external fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
|
|
138
138
|
|
|
139
|
+
@DoNotStrip @JvmStatic public external fun fuseboxAssertSingleHostState(): Boolean
|
|
140
|
+
|
|
139
141
|
@DoNotStrip @JvmStatic public external fun fuseboxEnabledRelease(): Boolean
|
|
140
142
|
|
|
141
143
|
@DoNotStrip @JvmStatic public external fun fuseboxNetworkInspectionEnabled(): Boolean
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<31da0143bec4eacc9884c950970f0a25>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -131,6 +131,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
131
131
|
|
|
132
132
|
override fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean = false
|
|
133
133
|
|
|
134
|
+
override fun fuseboxAssertSingleHostState(): Boolean = true
|
|
135
|
+
|
|
134
136
|
override fun fuseboxEnabledRelease(): Boolean = false
|
|
135
137
|
|
|
136
138
|
override fun fuseboxNetworkInspectionEnabled(): Boolean = false
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<14a5680355bb8c42e39a67edfa6a8974>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -78,6 +78,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
|
|
78
78
|
private var enableVirtualViewWindowFocusDetectionCache: Boolean? = null
|
|
79
79
|
private var enableWebPerformanceAPIsByDefaultCache: Boolean? = null
|
|
80
80
|
private var fixMappingOfEventPrioritiesBetweenFabricAndReactCache: Boolean? = null
|
|
81
|
+
private var fuseboxAssertSingleHostStateCache: Boolean? = null
|
|
81
82
|
private var fuseboxEnabledReleaseCache: Boolean? = null
|
|
82
83
|
private var fuseboxNetworkInspectionEnabledCache: Boolean? = null
|
|
83
84
|
private var hideOffscreenVirtualViewsOnIOSCache: Boolean? = null
|
|
@@ -648,6 +649,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
|
|
648
649
|
return cached
|
|
649
650
|
}
|
|
650
651
|
|
|
652
|
+
override fun fuseboxAssertSingleHostState(): Boolean {
|
|
653
|
+
var cached = fuseboxAssertSingleHostStateCache
|
|
654
|
+
if (cached == null) {
|
|
655
|
+
cached = currentProvider.fuseboxAssertSingleHostState()
|
|
656
|
+
accessedFeatureFlags.add("fuseboxAssertSingleHostState")
|
|
657
|
+
fuseboxAssertSingleHostStateCache = cached
|
|
658
|
+
}
|
|
659
|
+
return cached
|
|
660
|
+
}
|
|
661
|
+
|
|
651
662
|
override fun fuseboxEnabledRelease(): Boolean {
|
|
652
663
|
var cached = fuseboxEnabledReleaseCache
|
|
653
664
|
if (cached == null) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<5a348c354bb6dd2ddfbc869a9e2f0dbe>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -131,6 +131,8 @@ public interface ReactNativeFeatureFlagsProvider {
|
|
|
131
131
|
|
|
132
132
|
@DoNotStrip public fun fixMappingOfEventPrioritiesBetweenFabricAndReact(): Boolean
|
|
133
133
|
|
|
134
|
+
@DoNotStrip public fun fuseboxAssertSingleHostState(): Boolean
|
|
135
|
+
|
|
134
136
|
@DoNotStrip public fun fuseboxEnabledRelease(): Boolean
|
|
135
137
|
|
|
136
138
|
@DoNotStrip public fun fuseboxNetworkInspectionEnabled(): Boolean
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<5b2d44dcf36386f86f26c694d3f00229>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -363,6 +363,12 @@ class ReactNativeFeatureFlagsJavaProvider
|
|
|
363
363
|
return method(javaProvider_);
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
bool fuseboxAssertSingleHostState() override {
|
|
367
|
+
static const auto method =
|
|
368
|
+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fuseboxAssertSingleHostState");
|
|
369
|
+
return method(javaProvider_);
|
|
370
|
+
}
|
|
371
|
+
|
|
366
372
|
bool fuseboxEnabledRelease() override {
|
|
367
373
|
static const auto method =
|
|
368
374
|
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("fuseboxEnabledRelease");
|
|
@@ -811,6 +817,11 @@ bool JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabri
|
|
|
811
817
|
return ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
|
812
818
|
}
|
|
813
819
|
|
|
820
|
+
bool JReactNativeFeatureFlagsCxxInterop::fuseboxAssertSingleHostState(
|
|
821
|
+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
822
|
+
return ReactNativeFeatureFlags::fuseboxAssertSingleHostState();
|
|
823
|
+
}
|
|
824
|
+
|
|
814
825
|
bool JReactNativeFeatureFlagsCxxInterop::fuseboxEnabledRelease(
|
|
815
826
|
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
|
816
827
|
return ReactNativeFeatureFlags::fuseboxEnabledRelease();
|
|
@@ -1149,6 +1160,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
|
|
1149
1160
|
makeNativeMethod(
|
|
1150
1161
|
"fixMappingOfEventPrioritiesBetweenFabricAndReact",
|
|
1151
1162
|
JReactNativeFeatureFlagsCxxInterop::fixMappingOfEventPrioritiesBetweenFabricAndReact),
|
|
1163
|
+
makeNativeMethod(
|
|
1164
|
+
"fuseboxAssertSingleHostState",
|
|
1165
|
+
JReactNativeFeatureFlagsCxxInterop::fuseboxAssertSingleHostState),
|
|
1152
1166
|
makeNativeMethod(
|
|
1153
1167
|
"fuseboxEnabledRelease",
|
|
1154
1168
|
JReactNativeFeatureFlagsCxxInterop::fuseboxEnabledRelease),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<5a03db93d78fc1b14283ca3dc92db207>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -192,6 +192,9 @@ class JReactNativeFeatureFlagsCxxInterop
|
|
|
192
192
|
static bool fixMappingOfEventPrioritiesBetweenFabricAndReact(
|
|
193
193
|
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
|
194
194
|
|
|
195
|
+
static bool fuseboxAssertSingleHostState(
|
|
196
|
+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
|
197
|
+
|
|
195
198
|
static bool fuseboxEnabledRelease(
|
|
196
199
|
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
|
197
200
|
|
|
@@ -44,6 +44,7 @@ Pod::Spec.new do |s|
|
|
|
44
44
|
s.dependency "React-logger", version
|
|
45
45
|
s.dependency "React-debug", version
|
|
46
46
|
s.dependency "React-timing", version
|
|
47
|
+
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
|
|
47
48
|
|
|
48
49
|
s.resource_bundles = {'React-cxxreact_privacy' => 'PrivacyInfo.xcprivacy'}
|
|
49
50
|
|
|
@@ -37,6 +37,7 @@ Pod::Spec.new do |s|
|
|
|
37
37
|
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')
|
|
38
38
|
add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp')
|
|
39
39
|
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
|
|
40
|
+
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
|
|
40
41
|
if use_hermes()
|
|
41
42
|
s.dependency 'hermes-engine'
|
|
42
43
|
end
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
#ifdef REACT_NATIVE_DEBUGGER_ENABLED
|
|
12
12
|
#include "InspectorFlags.h"
|
|
13
|
+
#include "InspectorInterfaces.h"
|
|
13
14
|
#include "NetworkIOAgent.h"
|
|
14
15
|
#include "SessionState.h"
|
|
15
16
|
#include "TracingAgent.h"
|
|
@@ -145,6 +146,19 @@ class HostAgent::Impl final {
|
|
|
145
146
|
}
|
|
146
147
|
if (InspectorFlags::getInstance().getNetworkInspectionEnabled()) {
|
|
147
148
|
if (req.method == "Network.enable") {
|
|
149
|
+
auto& inspector = getInspectorInstance();
|
|
150
|
+
if (inspector.getSystemState().registeredPagesCount > 1) {
|
|
151
|
+
frontendChannel_(
|
|
152
|
+
cdp::jsonError(
|
|
153
|
+
req.id,
|
|
154
|
+
cdp::ErrorCode::InternalError,
|
|
155
|
+
"The Network domain is unavailable when multiple React Native hosts are registered."));
|
|
156
|
+
return {
|
|
157
|
+
.isFinishedHandlingRequest = true,
|
|
158
|
+
.shouldSendOKResponse = false,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
148
162
|
sessionState_.isNetworkDomainEnabled = true;
|
|
149
163
|
|
|
150
164
|
return {
|
|
@@ -216,6 +230,11 @@ class HostAgent::Impl final {
|
|
|
216
230
|
cdp::jsonNotification(
|
|
217
231
|
"ReactNativeApplication.metadataUpdated",
|
|
218
232
|
createHostMetadataPayload(hostMetadata_)));
|
|
233
|
+
auto& inspector = getInspectorInstance();
|
|
234
|
+
bool isSingleHost = inspector.getSystemState().registeredPagesCount <= 1;
|
|
235
|
+
if (!isSingleHost) {
|
|
236
|
+
emitSystemStateChanged(isSingleHost);
|
|
237
|
+
}
|
|
219
238
|
|
|
220
239
|
auto stashedTraceRecording =
|
|
221
240
|
targetController_.getDelegate()
|
|
@@ -374,6 +393,15 @@ class HostAgent::Impl final {
|
|
|
374
393
|
tracingAgent_.emitExternalTraceRecording(std::move(traceRecording));
|
|
375
394
|
}
|
|
376
395
|
|
|
396
|
+
void emitSystemStateChanged(bool isSingleHost) {
|
|
397
|
+
frontendChannel_(
|
|
398
|
+
cdp::jsonNotification(
|
|
399
|
+
"ReactNativeApplication.systemStateChanged",
|
|
400
|
+
folly::dynamic::object("isSingleHost", isSingleHost)));
|
|
401
|
+
|
|
402
|
+
frontendChannel_(cdp::jsonNotification("Network.disable"));
|
|
403
|
+
}
|
|
404
|
+
|
|
377
405
|
private:
|
|
378
406
|
enum class FuseboxClientType { Unknown, Fusebox, NonFusebox };
|
|
379
407
|
|
|
@@ -480,6 +508,7 @@ class HostAgent::Impl final {
|
|
|
480
508
|
}
|
|
481
509
|
void emitExternalTraceRecording(tracing::TraceRecordingState traceRecording) {
|
|
482
510
|
}
|
|
511
|
+
void emitSystemStateChanged(bool isSingleHost) {}
|
|
483
512
|
};
|
|
484
513
|
|
|
485
514
|
#endif // REACT_NATIVE_DEBUGGER_ENABLED
|
|
@@ -519,6 +548,10 @@ void HostAgent::emitExternalTraceRecording(
|
|
|
519
548
|
impl_->emitExternalTraceRecording(std::move(traceRecording));
|
|
520
549
|
}
|
|
521
550
|
|
|
551
|
+
void HostAgent::emitSystemStateChanged(bool isSingleHost) const {
|
|
552
|
+
impl_->emitSystemStateChanged(isSingleHost);
|
|
553
|
+
}
|
|
554
|
+
|
|
522
555
|
#pragma mark - Tracing
|
|
523
556
|
|
|
524
557
|
HostTracingAgent::HostTracingAgent(tracing::TraceRecordingState& state)
|
|
@@ -79,6 +79,12 @@ class HostAgent final {
|
|
|
79
79
|
*/
|
|
80
80
|
void emitExternalTraceRecording(tracing::TraceRecordingState traceRecording) const;
|
|
81
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Emits a system state changed event when the number of ReactHost instances
|
|
84
|
+
* changes.
|
|
85
|
+
*/
|
|
86
|
+
void emitSystemStateChanged(bool isSingleHost) const;
|
|
87
|
+
|
|
82
88
|
private:
|
|
83
89
|
// We use the private implementation idiom to ensure this class has the same
|
|
84
90
|
// layout regardless of whether REACT_NATIVE_DEBUGGER_ENABLED is defined. The
|
|
@@ -320,6 +320,11 @@ class JSINSPECTOR_EXPORT HostTarget : public EnableExecutorFromThis<HostTarget>
|
|
|
320
320
|
*/
|
|
321
321
|
void emitTraceRecordingForFirstFuseboxClient(tracing::TraceRecordingState traceRecording) const;
|
|
322
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Emits a system state changed event to all active sessions.
|
|
325
|
+
*/
|
|
326
|
+
void emitSystemStateChanged(bool isSingleHost) const;
|
|
327
|
+
|
|
323
328
|
private:
|
|
324
329
|
/**
|
|
325
330
|
* Constructs a new HostTarget.
|
|
@@ -17,6 +17,10 @@ InspectorFlags& InspectorFlags::getInstance() {
|
|
|
17
17
|
return instance;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
bool InspectorFlags::getAssertSingleHostState() const {
|
|
21
|
+
return loadFlagsAndAssertUnchanged().assertSingleHostState;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
bool InspectorFlags::getFuseboxEnabled() const {
|
|
21
25
|
if (fuseboxDisabledForTest_) {
|
|
22
26
|
return false;
|
|
@@ -48,6 +52,8 @@ void InspectorFlags::dangerouslyDisableFuseboxForTest() {
|
|
|
48
52
|
const InspectorFlags::Values& InspectorFlags::loadFlagsAndAssertUnchanged()
|
|
49
53
|
const {
|
|
50
54
|
InspectorFlags::Values newValues = {
|
|
55
|
+
.assertSingleHostState =
|
|
56
|
+
ReactNativeFeatureFlags::fuseboxAssertSingleHostState(),
|
|
51
57
|
.fuseboxEnabled =
|
|
52
58
|
#if defined(REACT_NATIVE_DEBUGGER_ENABLED)
|
|
53
59
|
true,
|
|
@@ -19,6 +19,12 @@ class InspectorFlags {
|
|
|
19
19
|
public:
|
|
20
20
|
static InspectorFlags &getInstance();
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Flag determining if the inspector backend should strictly assert that only
|
|
24
|
+
* a single host is registered.
|
|
25
|
+
*/
|
|
26
|
+
bool getAssertSingleHostState() const;
|
|
27
|
+
|
|
22
28
|
/**
|
|
23
29
|
* Flag determining if the modern CDP backend should be enabled.
|
|
24
30
|
*/
|
|
@@ -54,6 +60,7 @@ class InspectorFlags {
|
|
|
54
60
|
|
|
55
61
|
private:
|
|
56
62
|
struct Values {
|
|
63
|
+
bool assertSingleHostState;
|
|
57
64
|
bool fuseboxEnabled;
|
|
58
65
|
bool isProfilingBuild;
|
|
59
66
|
bool networkInspectionEnabled;
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#include "InspectorInterfaces.h"
|
|
9
9
|
|
|
10
|
+
#include "InspectorFlags.h"
|
|
11
|
+
|
|
10
12
|
#include <cassert>
|
|
11
13
|
#include <list>
|
|
12
14
|
#include <mutex>
|
|
@@ -35,6 +37,14 @@ namespace {
|
|
|
35
37
|
|
|
36
38
|
class InspectorImpl : public IInspector {
|
|
37
39
|
public:
|
|
40
|
+
InspectorImpl() {
|
|
41
|
+
systemStateListener_ = std::make_shared<SystemStateListener>(systemState_);
|
|
42
|
+
auto& inspectorFlags = InspectorFlags::getInstance();
|
|
43
|
+
if (inspectorFlags.getAssertSingleHostState()) {
|
|
44
|
+
registerPageStatusListener(systemStateListener_);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
int addPage(
|
|
39
49
|
const std::string& description,
|
|
40
50
|
const std::string& vm,
|
|
@@ -50,7 +60,21 @@ class InspectorImpl : public IInspector {
|
|
|
50
60
|
void registerPageStatusListener(
|
|
51
61
|
std::weak_ptr<IPageStatusListener> listener) override;
|
|
52
62
|
|
|
63
|
+
InspectorSystemState getSystemState() const override;
|
|
64
|
+
|
|
53
65
|
private:
|
|
66
|
+
class SystemStateListener : public IPageStatusListener {
|
|
67
|
+
public:
|
|
68
|
+
explicit SystemStateListener(InspectorSystemState& state) : state_(state) {}
|
|
69
|
+
|
|
70
|
+
void onPageAdded(int /*pageId*/) override {
|
|
71
|
+
state_.registeredPagesCount++;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private:
|
|
75
|
+
InspectorSystemState& state_;
|
|
76
|
+
};
|
|
77
|
+
|
|
54
78
|
class Page {
|
|
55
79
|
public:
|
|
56
80
|
Page(
|
|
@@ -74,6 +98,8 @@ class InspectorImpl : public IInspector {
|
|
|
74
98
|
int nextPageId_{1};
|
|
75
99
|
std::map<int, Page> pages_;
|
|
76
100
|
std::list<std::weak_ptr<IPageStatusListener>> listeners_;
|
|
101
|
+
InspectorSystemState systemState_{0};
|
|
102
|
+
std::shared_ptr<SystemStateListener> systemStateListener_;
|
|
77
103
|
};
|
|
78
104
|
|
|
79
105
|
InspectorImpl::Page::Page(
|
|
@@ -116,6 +142,12 @@ int InspectorImpl::addPage(
|
|
|
116
142
|
pageId,
|
|
117
143
|
Page{pageId, description, vm, std::move(connectFunc), capabilities});
|
|
118
144
|
|
|
145
|
+
for (const auto& listenerWeak : listeners_) {
|
|
146
|
+
if (auto listener = listenerWeak.lock()) {
|
|
147
|
+
listener->onPageAdded(pageId);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
119
151
|
return pageId;
|
|
120
152
|
}
|
|
121
153
|
|
|
@@ -175,6 +207,11 @@ void InspectorImpl::registerPageStatusListener(
|
|
|
175
207
|
}
|
|
176
208
|
listeners_.push_back(listener);
|
|
177
209
|
}
|
|
210
|
+
|
|
211
|
+
InspectorSystemState InspectorImpl::getSystemState() const {
|
|
212
|
+
std::scoped_lock lock(mutex_);
|
|
213
|
+
return systemState_;
|
|
214
|
+
}
|
|
178
215
|
} // namespace
|
|
179
216
|
|
|
180
217
|
IInspector& getInspectorInstance() {
|
|
@@ -51,6 +51,11 @@ struct InspectorPageDescription {
|
|
|
51
51
|
// Alias for backwards compatibility.
|
|
52
52
|
using InspectorPage = InspectorPageDescription;
|
|
53
53
|
|
|
54
|
+
struct InspectorSystemState {
|
|
55
|
+
/** The total count of pages registered during the app lifetime. */
|
|
56
|
+
int registeredPagesCount;
|
|
57
|
+
};
|
|
58
|
+
|
|
54
59
|
/// IRemoteConnection allows the VM to send debugger messages to the client.
|
|
55
60
|
/// IRemoteConnection's methods are safe to call from any thread *if*
|
|
56
61
|
/// InspectorPackagerConnection.cpp is in use.
|
|
@@ -78,7 +83,8 @@ class JSINSPECTOR_EXPORT ILocalConnection : public IDestructible {
|
|
|
78
83
|
class JSINSPECTOR_EXPORT IPageStatusListener : public IDestructible {
|
|
79
84
|
public:
|
|
80
85
|
virtual ~IPageStatusListener() = 0;
|
|
81
|
-
virtual void
|
|
86
|
+
virtual void onPageAdded(int /*pageId*/) {}
|
|
87
|
+
virtual void onPageRemoved(int /*pageId*/) {}
|
|
82
88
|
};
|
|
83
89
|
|
|
84
90
|
/// IInspector tracks debuggable JavaScript targets (pages).
|
|
@@ -127,6 +133,11 @@ class JSINSPECTOR_EXPORT IInspector : public IDestructible {
|
|
|
127
133
|
* when pages are removed.
|
|
128
134
|
*/
|
|
129
135
|
virtual void registerPageStatusListener(std::weak_ptr<IPageStatusListener> listener) = 0;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Get the current \c InspectorSystemState object.
|
|
139
|
+
*/
|
|
140
|
+
virtual InspectorSystemState getSystemState() const = 0;
|
|
130
141
|
};
|
|
131
142
|
|
|
132
143
|
class NotImplementedException : public std::exception {
|
|
@@ -53,7 +53,17 @@ TracingAgent::~TracingAgent() {
|
|
|
53
53
|
|
|
54
54
|
bool TracingAgent::handleRequest(const cdp::PreparsedRequest& req) {
|
|
55
55
|
if (req.method == "Tracing.start") {
|
|
56
|
-
|
|
56
|
+
auto& inspector = getInspectorInstance();
|
|
57
|
+
if (inspector.getSystemState().registeredPagesCount > 1) {
|
|
58
|
+
frontendChannel_(
|
|
59
|
+
cdp::jsonError(
|
|
60
|
+
req.id,
|
|
61
|
+
cdp::ErrorCode::InternalError,
|
|
62
|
+
"The Tracing domain is unavailable when multiple React Native hosts are registered."));
|
|
63
|
+
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
if (sessionState_.isDebuggerDomainEnabled) {
|
|
58
68
|
frontendChannel_(
|
|
59
69
|
cdp::jsonError(
|
|
@@ -42,6 +42,7 @@ Pod::Spec.new do |s|
|
|
|
42
42
|
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')
|
|
43
43
|
add_dependency(s, "React-jsinspectorcdp", :framework_name => 'jsinspector_moderncdp')
|
|
44
44
|
add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
|
|
45
|
+
add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"])
|
|
45
46
|
|
|
46
47
|
add_rn_third_party_dependencies(s)
|
|
47
48
|
add_rncore_dependency(s)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<efd875dca79abd383d527b063063051f>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -242,6 +242,10 @@ bool ReactNativeFeatureFlags::fixMappingOfEventPrioritiesBetweenFabricAndReact()
|
|
|
242
242
|
return getAccessor().fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
bool ReactNativeFeatureFlags::fuseboxAssertSingleHostState() {
|
|
246
|
+
return getAccessor().fuseboxAssertSingleHostState();
|
|
247
|
+
}
|
|
248
|
+
|
|
245
249
|
bool ReactNativeFeatureFlags::fuseboxEnabledRelease() {
|
|
246
250
|
return getAccessor().fuseboxEnabledRelease();
|
|
247
251
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
|
-
* @generated SignedSource<<
|
|
7
|
+
* @generated SignedSource<<95ab3eb7a8aab0a72095cc9ad7c583ce>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -309,6 +309,11 @@ class ReactNativeFeatureFlags {
|
|
|
309
309
|
*/
|
|
310
310
|
RN_EXPORT static bool fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
|
311
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Enable system assertion validating that Fusebox is configured with a single host. When set, the CDP backend will dynamically disable features (Perf and Network) in the event that multiple hosts are registered (undefined behaviour), and broadcast this over `ReactNativeApplication.systemStateChanged`.
|
|
314
|
+
*/
|
|
315
|
+
RN_EXPORT static bool fuseboxAssertSingleHostState();
|
|
316
|
+
|
|
312
317
|
/**
|
|
313
318
|
* Flag determining if the React Native DevTools (Fusebox) CDP backend should be enabled in release builds. This flag is global and should not be changed across React Host lifetimes.
|
|
314
319
|
*/
|