Skip to content

Commit 9aae84a

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Remove some web debugging remnants (#48054)
Summary: Pull Request resolved: #48054 Web debugging should be fully removed as of recent, so lets remove some of the gunk that was powering it, and checks for that environment. I did some string searches for the following: * isAsyncDebugging * debugRemotely * isDebuggingRemotely * isRemoteDebuggingAvailable * WebSocketExecutor * JavaJSExecutor * ProxyJavaScriptExecutor * RELOAD_APP_EXTRA_JS_PROXY * getJSBundleURLForRemoteDebugging * onReloadWithJSDebugger * setRemoteJSDebugEnabled * WebsocketJavaScriptExecutor * createRemoteDebuggerBundleLoader 1. `expo-modules-core` exposes its own `isAsyncDebugging` by checking for `nativeCallSyncHook`, but does not depend on `DebugEnvironment`. 2. `expo-dev-menu` does read `isDebuggingRemotely` from `DevSettings`. 3. Realm does a check in Native using `objc_lookUpClass("RCTWebSocketExecutor")` but will gracefully handle `nil` if it does not exist 4. Some more usages (e.g. `onReloadWithJSDebugger`) in vendored packages of `expo-dev-launcher` for RN 0.74 I created an issue for Expo mentioning both here: expo/expo#33371 Changelog: [General][Breaking] - Remove some web debugging remnants Reviewed By: huntie Differential Revision: D66553934 fbshipit-source-id: deec382b1c8bda393fddb8682aa91b26afd9fbe3
1 parent 3e2e8ec commit 9aae84a

35 files changed

+11
-1302
lines changed

packages/react-native/Libraries/ReactNative/PaperUIManager.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ function getConstants(): Object {
3636
function getViewManagerConfig(viewManagerName: string): any {
3737
if (
3838
viewManagerConfigs[viewManagerName] === undefined &&
39-
global.nativeCallSyncHook && // If we're in the Chrome Debugger, let's not even try calling the sync method
4039
NativeUIManager.getConstantsForViewManager
4140
) {
4241
try {

packages/react-native/Libraries/Utilities/Appearance.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import typeof INativeAppearance from './NativeAppearance';
1414

1515
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
1616
import EventEmitter from '../vendor/emitter/EventEmitter';
17-
import {isAsyncDebugging} from './DebugEnvironment';
1817
import invariant from 'invariant';
1918

2019
type Appearance = {
@@ -74,13 +73,6 @@ function getState(): $NonMaybeType<typeof lazyState> {
7473
* the `useColorScheme` hook.
7574
*/
7675
export function getColorScheme(): ?ColorSchemeName {
77-
if (__DEV__) {
78-
if (isAsyncDebugging) {
79-
// Hard code light theme when using the async debugger as
80-
// sync calls aren't supported
81-
return 'light';
82-
}
83-
}
8476
let colorScheme = null;
8577
const state = getState();
8678
const {NativeAppearance} = state;

packages/react-native/Libraries/Utilities/DebugEnvironment.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8863,11 +8863,6 @@ declare module.exports: TBackHandler;
88638863
"
88648864
`;
88658865

8866-
exports[`public API should not change unintentionally Libraries/Utilities/DebugEnvironment.js 1`] = `
8867-
"declare export let isAsyncDebugging: boolean;
8868-
"
8869-
`;
8870-
88718866
exports[`public API should not change unintentionally Libraries/Utilities/DevLoadingView.js 1`] = `
88728867
"declare module.exports: {
88738868
showMessage(message: string, type: \\"load\\" | \\"refresh\\"): void,
@@ -10307,7 +10302,6 @@ exports[`public API should not change unintentionally src/private/specs/modules/
1030710302
"export interface Spec extends TurboModule {
1030810303
+show: () => void;
1030910304
+reload: () => void;
10310-
+debugRemotely: (enableDebug: boolean) => void;
1031110305
+setProfilingEnabled: (enabled: boolean) => void;
1031210306
+setHotLoadingEnabled: (enabled: boolean) => void;
1031310307
}
@@ -10321,7 +10315,6 @@ exports[`public API should not change unintentionally src/private/specs/modules/
1032110315
+reloadWithReason?: (reason: string) => void;
1032210316
+onFastRefresh?: () => void;
1032310317
+setHotLoadingEnabled: (isHotLoadingEnabled: boolean) => void;
10324-
+setIsDebuggingRemotely: (isDebuggingRemotelyEnabled: boolean) => void;
1032510318
+setProfilingEnabled: (isProfilingEnabled: boolean) => void;
1032610319
+toggleElementInspector: () => void;
1032710320
+addMenuItem: (title: string) => void;

packages/react-native/React/CoreModules/CoreModulesPlugins.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Class RCTRedBoxCls(void) __attribute__((used));
5050
Class RCTSourceCodeCls(void) __attribute__((used));
5151
Class RCTStatusBarManagerCls(void) __attribute__((used));
5252
Class RCTTimingCls(void) __attribute__((used));
53-
Class RCTWebSocketExecutorCls(void) __attribute__((used));
5453
Class RCTWebSocketModuleCls(void) __attribute__((used));
5554
Class RCTBlobManagerCls(void) __attribute__((used));
5655

packages/react-native/React/CoreModules/CoreModulesPlugins.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Class RCTCoreModulesClassProvider(const char *name) {
4040
{"SourceCode", RCTSourceCodeCls},
4141
{"StatusBarManager", RCTStatusBarManagerCls},
4242
{"Timing", RCTTimingCls},
43-
{"WebSocketExecutor", RCTWebSocketExecutorCls},
4443
{"WebSocketModule", RCTWebSocketModuleCls},
4544
{"BlobModule", RCTBlobManagerCls},
4645
};

packages/react-native/React/CoreModules/RCTDevMenu.mm

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,6 @@ - (void)registerHotkeys
152152
[(RCTDevSettings *)[weakSelf.moduleRegistry moduleForName:"DevSettings"]
153153
toggleElementInspector];
154154
}];
155-
156-
// Reload in normal mode
157-
[commands registerKeyCommandWithInput:@"n"
158-
modifierFlags:UIKeyModifierCommand
159-
action:^(__unused UIKeyCommand *command) {
160-
[(RCTDevSettings *)[weakSelf.moduleRegistry moduleForName:"DevSettings"]
161-
setIsDebuggingRemotely:NO];
162-
}];
163155
#endif
164156
}
165157

@@ -456,12 +448,6 @@ - (BOOL)shakeToShow
456448
RCTTriggerReloadCommandListeners(@"Unknown from JS");
457449
}
458450

459-
RCT_EXPORT_METHOD(debugRemotely : (BOOL)enableDebug)
460-
{
461-
WARN_DEPRECATED_DEV_MENU_EXPORT();
462-
((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isDebuggingRemotely = enableDebug;
463-
}
464-
465451
RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled)
466452
{
467453
WARN_DEPRECATED_DEV_MENU_EXPORT();
@@ -526,10 +512,6 @@ - (void)addItem:(RCTDevMenu *)item
526512
{
527513
}
528514

529-
- (void)debugRemotely:(BOOL)enableDebug
530-
{
531-
}
532-
533515
- (BOOL)isActionSheetShown
534516
{
535517
return NO;

packages/react-native/React/CoreModules/RCTDevSettings.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,8 @@
4747
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;
4848

4949
@property (nonatomic, readonly) BOOL isHotLoadingAvailable;
50-
@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable;
5150
@property (nonatomic, readonly) BOOL isDeviceDebuggingAvailable;
5251

53-
/**
54-
* Whether the bridge is connected to a remote JS executor.
55-
*/
56-
@property (nonatomic, assign) BOOL isDebuggingRemotely;
57-
5852
/*
5953
* Whether shaking will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but
6054
* you may wish to disable it so that you can provide your own shake handler.

packages/react-native/React/CoreModules/RCTDevSettings.mm

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
static NSString *const kRCTDevSettingProfilingEnabled = @"profilingEnabled";
2828
static NSString *const kRCTDevSettingHotLoadingEnabled = @"hotLoadingEnabled";
2929
static NSString *const kRCTDevSettingIsInspectorShown = @"showInspector";
30-
static NSString *const kRCTDevSettingIsDebuggingRemotely = @"isDebuggingRemotely";
3130
static NSString *const kRCTDevSettingExecutorOverrideClass = @"executor-override";
3231
static NSString *const kRCTDevSettingShakeToShowDevMenu = @"shakeToShow";
3332
static NSString *const kRCTDevSettingIsPerfMonitorShown = @"RCTPerfMonitorKey";
@@ -124,9 +123,6 @@ - (void)_reloadWithDefaults:(NSDictionary *)defaultValues
124123

125124
@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec, RCTDevSettingsInspectable> {
126125
BOOL _isJSLoaded;
127-
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
128-
RCTHandlerToken _bridgeExecutorOverrideToken;
129-
#endif
130126
}
131127

132128
@property (nonatomic, strong) Class executorClass;
@@ -183,18 +179,6 @@ - (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource
183179
- (void)initialize
184180
{
185181
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
186-
if ([self _isBridgeMode]) {
187-
RCTBridge *__weak weakBridge = self.bridge;
188-
_bridgeExecutorOverrideToken = [[RCTPackagerConnection sharedPackagerConnection]
189-
addNotificationHandler:^(id params) {
190-
if (params != (id)kCFNull && [params[@"debug"] boolValue]) {
191-
weakBridge.executorClass = objc_lookUpClass("RCTWebSocketExecutor");
192-
}
193-
}
194-
queue:dispatch_get_main_queue()
195-
forMethod:@"reload"];
196-
}
197-
198182
if (numInitializedModules++ == 0) {
199183
reloadToken = [[RCTPackagerConnection sharedPackagerConnection]
200184
addNotificationHandler:^(id params) {
@@ -255,10 +239,6 @@ - (void)invalidate
255239
{
256240
[super invalidate];
257241
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
258-
if ([self _isBridgeMode]) {
259-
[[RCTPackagerConnection sharedPackagerConnection] removeHandler:_bridgeExecutorOverrideToken];
260-
}
261-
262242
if (--numInitializedModules == 0) {
263243
[[RCTPackagerConnection sharedPackagerConnection] removeHandler:reloadToken];
264244
#if RCT_DEV_MENU
@@ -296,15 +276,6 @@ - (BOOL)isDeviceDebuggingAvailable
296276
#endif // RCT_ENABLE_INSPECTOR
297277
}
298278

299-
- (BOOL)isRemoteDebuggingAvailable
300-
{
301-
if (RCTTurboModuleEnabled()) {
302-
return NO;
303-
}
304-
Class jsDebuggingExecutorClass = objc_lookUpClass("RCTWebSocketExecutor");
305-
return (jsDebuggingExecutorClass != nil);
306-
}
307-
308279
- (BOOL)isHotLoadingAvailable
309280
{
310281
if (self.bundleManager.bundleURL) {
@@ -338,30 +309,6 @@ - (BOOL)isShakeToShowDevMenuEnabled
338309
return [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue];
339310
}
340311

341-
RCT_EXPORT_METHOD(setIsDebuggingRemotely : (BOOL)enabled)
342-
{
343-
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingIsDebuggingRemotely];
344-
[self _remoteDebugSettingDidChange];
345-
}
346-
347-
- (BOOL)isDebuggingRemotely
348-
{
349-
return [[self settingForKey:kRCTDevSettingIsDebuggingRemotely] boolValue];
350-
}
351-
352-
- (void)_remoteDebugSettingDidChange
353-
{
354-
// This value is passed as a command-line argument, so fall back to reading from NSUserDefaults directly
355-
NSString *executorOverride = [[NSUserDefaults standardUserDefaults] stringForKey:kRCTDevSettingExecutorOverrideClass];
356-
Class executorOverrideClass = executorOverride ? NSClassFromString(executorOverride) : nil;
357-
if (executorOverrideClass) {
358-
self.executorClass = executorOverrideClass;
359-
} else {
360-
BOOL enabled = self.isRemoteDebuggingAvailable && self.isDebuggingRemotely;
361-
self.executorClass = enabled ? objc_getClass("RCTWebSocketExecutor") : nil;
362-
}
363-
}
364-
365312
RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled)
366313
{
367314
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingProfilingEnabled];
@@ -460,7 +407,7 @@ - (void)setExecutorClass:(Class)executorClass
460407
// support for custom executors in the dev menu. But right now this is
461408
// needed to prevent overriding a custom executor with the default if a
462409
// custom executor has been set directly on the bridge
463-
if (executorClass == Nil && self.bridge.executorClass != objc_lookUpClass("RCTWebSocketExecutor")) {
410+
if (executorClass == Nil) {
464411
return;
465412
}
466413

@@ -518,7 +465,6 @@ - (void)setupHMRClientWithAdditionalBundleURL:(NSURL *)bundleURL
518465
*/
519466
- (void)_synchronizeAllSettings
520467
{
521-
[self _remoteDebugSettingDidChange];
522468
[self _profilingSettingDidChange];
523469
}
524470

@@ -578,10 +524,6 @@ - (BOOL)isHotLoadingAvailable
578524
{
579525
return NO;
580526
}
581-
- (BOOL)isRemoteDebuggingAvailable
582-
{
583-
return NO;
584-
}
585527
+ (BOOL)requiresMainQueueSetup
586528
{
587529
return NO;
@@ -602,9 +544,6 @@ - (void)onFastRefresh
602544
- (void)setHotLoadingEnabled:(BOOL)isHotLoadingEnabled
603545
{
604546
}
605-
- (void)setIsDebuggingRemotely:(BOOL)isDebuggingRemotelyEnabled
606-
{
607-
}
608547
- (void)setProfilingEnabled:(BOOL)isProfilingEnabled
609548
{
610549
}

packages/react-native/React/CoreModules/RCTWebSocketExecutor.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)