Skip to content

Commit bef88f7

Browse files
authored
[DevTools] Stop setting unused global variables (facebook#35532)
1 parent 01c4d03 commit bef88f7

File tree

3 files changed

+8
-33
lines changed

3 files changed

+8
-33
lines changed

packages/react-devtools-inline/src/backend.js

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import {initBackend} from 'react-devtools-shared/src/backend';
66
import {installHook} from 'react-devtools-shared/src/hook';
77
import setupNativeStyleEditor from 'react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor';
88

9-
import type {BackendBridge} from 'react-devtools-shared/src/bridge';
9+
import type {
10+
BackendBridge,
11+
SavedPreferencesParams,
12+
} from 'react-devtools-shared/src/bridge';
1013
import type {Wall} from 'react-devtools-shared/src/frontend/types';
1114
import {
1215
getIfReloadedAndProfiling,
@@ -16,31 +19,14 @@ import {
1619
} from 'react-devtools-shared/src/utils';
1720

1821
function startActivation(contentWindow: any, bridge: BackendBridge) {
19-
const onSavedPreferences = (data: $FlowFixMe) => {
22+
const onSavedPreferences = (data: SavedPreferencesParams) => {
2023
// This is the only message we're listening for,
2124
// so it's safe to cleanup after we've received it.
2225
bridge.removeListener('savedPreferences', onSavedPreferences);
2326

24-
const {
25-
appendComponentStack,
26-
breakOnConsoleErrors,
27-
componentFilters,
28-
showInlineWarningsAndErrors,
29-
hideConsoleLogsInStrictMode,
30-
disableSecondConsoleLogDimmingInStrictMode,
31-
} = data;
32-
33-
contentWindow.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ =
34-
appendComponentStack;
35-
contentWindow.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ =
36-
breakOnConsoleErrors;
27+
const {componentFilters} = data;
28+
3729
contentWindow.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
38-
contentWindow.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ =
39-
showInlineWarningsAndErrors;
40-
contentWindow.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ =
41-
hideConsoleLogsInStrictMode;
42-
contentWindow.__REACT_DEVTOOLS_DISABLE_SECOND_CONSOLE_LOG_DIMMING_IN_STRICT_MODE__ =
43-
disableSecondConsoleLogDimmingInStrictMode;
4430

4531
// TRICKY
4632
// The backend entry point may be required in the context of an iframe or the parent window.
@@ -49,15 +35,7 @@ function startActivation(contentWindow: any, bridge: BackendBridge) {
4935
// Technically we don't need to store them on the contentWindow in this case,
5036
// but it doesn't really hurt anything to store them there too.
5137
if (contentWindow !== window) {
52-
window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = appendComponentStack;
53-
window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = breakOnConsoleErrors;
5438
window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = componentFilters;
55-
window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ =
56-
showInlineWarningsAndErrors;
57-
window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ =
58-
hideConsoleLogsInStrictMode;
59-
window.__REACT_DEVTOOLS_DISABLE_SECOND_CONSOLE_LOG_DIMMING_IN_STRICT_MODE__ =
60-
disableSecondConsoleLogDimmingInStrictMode;
6139
}
6240

6341
finishActivation(contentWindow, bridge);

packages/react-devtools-shared/src/__tests__/setupTests.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,6 @@ beforeEach(() => {
240240
setSavedComponentFilters(getDefaultComponentFilters());
241241
global.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = getDefaultComponentFilters();
242242

243-
// Also initialize inline warnings so that we can test them.
244-
global.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = true;
245-
246243
installHook(global, {
247244
appendComponentStack: true,
248245
breakOnConsoleErrors: false,

packages/react-devtools-shared/src/bridge.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ type NativeStyleEditor_SetValueParams = {
191191
value: string,
192192
};
193193

194-
type SavedPreferencesParams = {
194+
export type SavedPreferencesParams = {
195195
componentFilters: Array<ComponentFilter>,
196196
};
197197

0 commit comments

Comments
 (0)