Skip to content

Commit

Permalink
Remove some web debugging remnants
Browse files Browse the repository at this point in the history
Summary:
Web debuggig should be fully removed as of recent, so lets remove some of the gunk that was powering it, and checks for that environment.

Changelog: [Internal]

Differential Revision: D66553934
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Dec 2, 2024
1 parent fa8a25e commit 414abc0
Show file tree
Hide file tree
Showing 35 changed files with 11 additions and 1,301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function getConstants(): Object {
function getViewManagerConfig(viewManagerName: string): any {
if (
viewManagerConfigs[viewManagerName] === undefined &&
global.nativeCallSyncHook && // If we're in the Chrome Debugger, let's not even try calling the sync method
NativeUIManager.getConstantsForViewManager
) {
try {
Expand Down
8 changes: 0 additions & 8 deletions packages/react-native/Libraries/Utilities/Appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import typeof INativeAppearance from './NativeAppearance';

import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
import EventEmitter from '../vendor/emitter/EventEmitter';
import {isAsyncDebugging} from './DebugEnvironment';
import invariant from 'invariant';

type Appearance = {
Expand Down Expand Up @@ -74,13 +73,6 @@ function getState(): $NonMaybeType<typeof lazyState> {
* the `useColorScheme` hook.
*/
export function getColorScheme(): ?ColorSchemeName {
if (__DEV__) {
if (isAsyncDebugging) {
// Hard code light theme when using the async debugger as
// sync calls aren't supported
return 'light';
}
}
let colorScheme = null;
const state = getState();
const {NativeAppearance} = state;
Expand Down
16 changes: 0 additions & 16 deletions packages/react-native/Libraries/Utilities/DebugEnvironment.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8859,11 +8859,6 @@ declare module.exports: TBackHandler;
"
`;

exports[`public API should not change unintentionally Libraries/Utilities/DebugEnvironment.js 1`] = `
"declare export let isAsyncDebugging: boolean;
"
`;

exports[`public API should not change unintentionally Libraries/Utilities/DevLoadingView.js 1`] = `
"declare module.exports: {
showMessage(message: string, type: \\"load\\" | \\"refresh\\"): void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Class RCTRedBoxCls(void) __attribute__((used));
Class RCTSourceCodeCls(void) __attribute__((used));
Class RCTStatusBarManagerCls(void) __attribute__((used));
Class RCTTimingCls(void) __attribute__((used));
Class RCTWebSocketExecutorCls(void) __attribute__((used));
Class RCTWebSocketModuleCls(void) __attribute__((used));
Class RCTBlobManagerCls(void) __attribute__((used));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Class RCTCoreModulesClassProvider(const char *name) {
{"SourceCode", RCTSourceCodeCls},
{"StatusBarManager", RCTStatusBarManagerCls},
{"Timing", RCTTimingCls},
{"WebSocketExecutor", RCTWebSocketExecutorCls},
{"WebSocketModule", RCTWebSocketModuleCls},
{"BlobModule", RCTBlobManagerCls},
};
Expand Down
18 changes: 0 additions & 18 deletions packages/react-native/React/CoreModules/RCTDevMenu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@ - (void)registerHotkeys
[(RCTDevSettings *)[weakSelf.moduleRegistry moduleForName:"DevSettings"]
toggleElementInspector];
}];

// Reload in normal mode
[commands registerKeyCommandWithInput:@"n"
modifierFlags:UIKeyModifierCommand
action:^(__unused UIKeyCommand *command) {
[(RCTDevSettings *)[weakSelf.moduleRegistry moduleForName:"DevSettings"]
setIsDebuggingRemotely:NO];
}];
#endif
}

Expand Down Expand Up @@ -456,12 +448,6 @@ - (BOOL)shakeToShow
RCTTriggerReloadCommandListeners(@"Unknown from JS");
}

RCT_EXPORT_METHOD(debugRemotely : (BOOL)enableDebug)
{
WARN_DEPRECATED_DEV_MENU_EXPORT();
((RCTDevSettings *)[_moduleRegistry moduleForName:"DevSettings"]).isDebuggingRemotely = enableDebug;
}

RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled)
{
WARN_DEPRECATED_DEV_MENU_EXPORT();
Expand Down Expand Up @@ -526,10 +512,6 @@ - (void)addItem:(RCTDevMenu *)item
{
}

- (void)debugRemotely:(BOOL)enableDebug
{
}

- (BOOL)isActionSheetShown
{
return NO;
Expand Down
6 changes: 0 additions & 6 deletions packages/react-native/React/CoreModules/RCTDevSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,9 @@
- (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource;

@property (nonatomic, readonly) BOOL isHotLoadingAvailable;
@property (nonatomic, readonly) BOOL isRemoteDebuggingAvailable;
@property (nonatomic, readonly) BOOL isDeviceDebuggingAvailable;
@property (nonatomic, readonly) BOOL isJSCSamplingProfilerAvailable;

/**
* Whether the bridge is connected to a remote JS executor.
*/
@property (nonatomic, assign) BOOL isDebuggingRemotely;

/*
* Whether shaking will show RCTDevMenu. The menu is enabled by default if RCT_DEV=1, but
* you may wish to disable it so that you can provide your own shake handler.
Expand Down
63 changes: 1 addition & 62 deletions packages/react-native/React/CoreModules/RCTDevSettings.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
static NSString *const kRCTDevSettingProfilingEnabled = @"profilingEnabled";
static NSString *const kRCTDevSettingHotLoadingEnabled = @"hotLoadingEnabled";
static NSString *const kRCTDevSettingIsInspectorShown = @"showInspector";
static NSString *const kRCTDevSettingIsDebuggingRemotely = @"isDebuggingRemotely";
static NSString *const kRCTDevSettingExecutorOverrideClass = @"executor-override";
static NSString *const kRCTDevSettingShakeToShowDevMenu = @"shakeToShow";
static NSString *const kRCTDevSettingIsPerfMonitorShown = @"RCTPerfMonitorKey";
Expand Down Expand Up @@ -124,9 +123,6 @@ - (void)_reloadWithDefaults:(NSDictionary *)defaultValues

@interface RCTDevSettings () <RCTBridgeModule, RCTInvalidating, NativeDevSettingsSpec, RCTDevSettingsInspectable> {
BOOL _isJSLoaded;
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
RCTHandlerToken _bridgeExecutorOverrideToken;
#endif
}

@property (nonatomic, strong) Class executorClass;
Expand Down Expand Up @@ -183,18 +179,6 @@ - (instancetype)initWithDataSource:(id<RCTDevSettingsDataSource>)dataSource
- (void)initialize
{
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
if ([self _isBridgeMode]) {
RCTBridge *__weak weakBridge = self.bridge;
_bridgeExecutorOverrideToken = [[RCTPackagerConnection sharedPackagerConnection]
addNotificationHandler:^(id params) {
if (params != (id)kCFNull && [params[@"debug"] boolValue]) {
weakBridge.executorClass = objc_lookUpClass("RCTWebSocketExecutor");
}
}
queue:dispatch_get_main_queue()
forMethod:@"reload"];
}

if (numInitializedModules++ == 0) {
reloadToken = [[RCTPackagerConnection sharedPackagerConnection]
addNotificationHandler:^(id params) {
Expand Down Expand Up @@ -255,10 +239,6 @@ - (void)invalidate
{
[super invalidate];
#if RCT_DEV_SETTINGS_ENABLE_PACKAGER_CONNECTION
if ([self _isBridgeMode]) {
[[RCTPackagerConnection sharedPackagerConnection] removeHandler:_bridgeExecutorOverrideToken];
}

if (--numInitializedModules == 0) {
[[RCTPackagerConnection sharedPackagerConnection] removeHandler:reloadToken];
#if RCT_DEV_MENU
Expand Down Expand Up @@ -296,15 +276,6 @@ - (BOOL)isDeviceDebuggingAvailable
#endif // RCT_ENABLE_INSPECTOR
}

- (BOOL)isRemoteDebuggingAvailable
{
if (RCTTurboModuleEnabled()) {
return NO;
}
Class jsDebuggingExecutorClass = objc_lookUpClass("RCTWebSocketExecutor");
return (jsDebuggingExecutorClass != nil);
}

- (BOOL)isHotLoadingAvailable
{
if (self.bundleManager.bundleURL) {
Expand Down Expand Up @@ -338,30 +309,6 @@ - (BOOL)isShakeToShowDevMenuEnabled
return [[self settingForKey:kRCTDevSettingShakeToShowDevMenu] boolValue];
}

RCT_EXPORT_METHOD(setIsDebuggingRemotely : (BOOL)enabled)
{
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingIsDebuggingRemotely];
[self _remoteDebugSettingDidChange];
}

- (BOOL)isDebuggingRemotely
{
return [[self settingForKey:kRCTDevSettingIsDebuggingRemotely] boolValue];
}

- (void)_remoteDebugSettingDidChange
{
// This value is passed as a command-line argument, so fall back to reading from NSUserDefaults directly
NSString *executorOverride = [[NSUserDefaults standardUserDefaults] stringForKey:kRCTDevSettingExecutorOverrideClass];
Class executorOverrideClass = executorOverride ? NSClassFromString(executorOverride) : nil;
if (executorOverrideClass) {
self.executorClass = executorOverrideClass;
} else {
BOOL enabled = self.isRemoteDebuggingAvailable && self.isDebuggingRemotely;
self.executorClass = enabled ? objc_getClass("RCTWebSocketExecutor") : nil;
}
}

RCT_EXPORT_METHOD(setProfilingEnabled : (BOOL)enabled)
{
[self _updateSettingWithValue:@(enabled) forKey:kRCTDevSettingProfilingEnabled];
Expand Down Expand Up @@ -460,7 +407,7 @@ - (void)setExecutorClass:(Class)executorClass
// support for custom executors in the dev menu. But right now this is
// needed to prevent overriding a custom executor with the default if a
// custom executor has been set directly on the bridge
if (executorClass == Nil && self.bridge.executorClass != objc_lookUpClass("RCTWebSocketExecutor")) {
if (executorClass == Nil) {
return;
}

Expand Down Expand Up @@ -518,7 +465,6 @@ - (void)setupHMRClientWithAdditionalBundleURL:(NSURL *)bundleURL
*/
- (void)_synchronizeAllSettings
{
[self _remoteDebugSettingDidChange];
[self _profilingSettingDidChange];
}

Expand Down Expand Up @@ -578,10 +524,6 @@ - (BOOL)isHotLoadingAvailable
{
return NO;
}
- (BOOL)isRemoteDebuggingAvailable
{
return NO;
}
+ (BOOL)requiresMainQueueSetup
{
return NO;
Expand All @@ -602,9 +544,6 @@ - (void)onFastRefresh
- (void)setHotLoadingEnabled:(BOOL)isHotLoadingEnabled
{
}
- (void)setIsDebuggingRemotely:(BOOL)isDebuggingRemotelyEnabled
{
}
- (void)setProfilingEnabled:(BOOL)isProfilingEnabled
{
}
Expand Down
19 changes: 0 additions & 19 deletions packages/react-native/React/CoreModules/RCTWebSocketExecutor.h

This file was deleted.

Loading

0 comments on commit 414abc0

Please sign in to comment.