Skip to content

Commit d4ada07

Browse files
author
Juan Tejada
committed
Revert "Show warning in UI when duplicate installations of DevTools extension are detected (facebook#22563)"
This reverts commit 930c9e7.
1 parent e226151 commit d4ada07

File tree

6 files changed

+13
-115
lines changed

6 files changed

+13
-115
lines changed

packages/react-devtools-extensions/src/background.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
// @flow strict-local
1+
/* global chrome */
22

33
'use strict';
44

5-
declare var chrome: any;
6-
7-
const ports: {
8-
[tab: string]: {|devtools: any, 'content-script': any|},
9-
} = {};
5+
const ports = {};
106

117
const IS_FIREFOX = navigator.userAgent.indexOf('Firefox') >= 0;
128

13-
import {
14-
EXTENSION_INSTALL_CHECK,
15-
SHOW_DUPLICATE_EXTENSION_WARNING,
16-
} from './constants';
9+
import {EXTENSION_INSTALL_CHECK_MESSAGE} from './constants';
1710

1811
chrome.runtime.onConnect.addListener(function(port) {
1912
let tab = null;
@@ -127,9 +120,8 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
127120

128121
chrome.runtime.onMessageExternal.addListener(
129122
(request, sender, sendResponse) => {
130-
if (request === EXTENSION_INSTALL_CHECK) {
123+
if (request === EXTENSION_INSTALL_CHECK_MESSAGE) {
131124
sendResponse(true);
132-
chrome.runtime.sendMessage(SHOW_DUPLICATE_EXTENSION_WARNING);
133125
}
134126
},
135127
);

packages/react-devtools-extensions/src/checkForDuplicateInstallations.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import {
1515
__DEBUG__,
1616
} from 'react-devtools-shared/src/constants';
1717
import {
18-
EXTENSION_INSTALL_CHECK,
18+
EXTENSION_INSTALL_CHECK_MESSAGE,
1919
EXTENSION_INSTALLATION_TYPE,
2020
} from './constants';
2121

22-
const UNRECOGNIZED_EXTENSION_ERROR =
22+
const UNRECOGNIZED_EXTENSION_WARNING =
2323
'React Developer Tools: You are running an unrecognized installation of the React Developer Tools extension, which might conflict with other versions of the extension installed in your browser. ' +
2424
'Please make sure you only have a single version of the extension installed or enabled. ' +
2525
'If you are developing this extension locally, make sure to build the extension using the `yarn build:<browser>:local` command.';
@@ -70,9 +70,9 @@ export function checkForDuplicateInstallations(callback: boolean => void) {
7070
// detect if there are other installations of DevTools present.
7171
// In this case, assume there are no duplicate exensions and show a warning about
7272
// potential conflicts.
73-
console.error(UNRECOGNIZED_EXTENSION_ERROR);
73+
console.error(UNRECOGNIZED_EXTENSION_WARNING);
7474
chrome.devtools.inspectedWindow.eval(
75-
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
75+
`console.error("${UNRECOGNIZED_EXTENSION_WARNING}")`,
7676
);
7777
callback(false);
7878
break;
@@ -82,9 +82,9 @@ export function checkForDuplicateInstallations(callback: boolean => void) {
8282
// are other installations of DevTools present.
8383
// In this case, assume there are no duplicate exensions and show a warning about
8484
// potential conflicts.
85-
console.error(UNRECOGNIZED_EXTENSION_ERROR);
85+
console.error(UNRECOGNIZED_EXTENSION_WARNING);
8686
chrome.devtools.inspectedWindow.eval(
87-
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
87+
`console.error("${UNRECOGNIZED_EXTENSION_WARNING}")`,
8888
);
8989
callback(false);
9090
break;
@@ -107,7 +107,7 @@ function checkForInstalledExtension(extensionId: string): Promise<boolean> {
107107
return new Promise(resolve => {
108108
chrome.runtime.sendMessage(
109109
extensionId,
110-
EXTENSION_INSTALL_CHECK,
110+
EXTENSION_INSTALL_CHECK_MESSAGE,
111111
response => {
112112
if (__DEBUG__) {
113113
console.log(

packages/react-devtools-extensions/src/constants.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ declare var chrome: any;
1717

1818
export const CURRENT_EXTENSION_ID = chrome.runtime.id;
1919

20-
export const EXTENSION_INSTALL_CHECK = 'extension-install-check';
21-
export const SHOW_DUPLICATE_EXTENSION_WARNING =
22-
'show-duplicate-extension-warning';
20+
export const EXTENSION_INSTALL_CHECK_MESSAGE = 'extension-install-check';
2321

2422
export const EXTENSION_INSTALLATION_TYPE:
2523
| 'public'

packages/react-devtools-extensions/src/main.js

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ import {
2222
import DevTools from 'react-devtools-shared/src/devtools/views/DevTools';
2323
import {__DEBUG__} from 'react-devtools-shared/src/constants';
2424
import {logEvent} from 'react-devtools-shared/src/Logger';
25-
import {
26-
CURRENT_EXTENSION_ID,
27-
EXTENSION_INSTALLATION_TYPE,
28-
SHOW_DUPLICATE_EXTENSION_WARNING,
29-
} from './constants';
25+
import {CURRENT_EXTENSION_ID, EXTENSION_INSTALLATION_TYPE} from './constants';
3026
import {checkForDuplicateInstallations} from './checkForDuplicateInstallations';
3127

3228
const LOCAL_STORAGE_SUPPORTS_PROFILING_KEY =
@@ -113,39 +109,11 @@ function createPanelIfReactLoaded() {
113109
let mostRecentOverrideTab = null;
114110
let render = null;
115111
let root = null;
116-
let warnIfDuplicateInstallation = false;
117112

118113
const tabId = chrome.devtools.inspectedWindow.tabId;
119114

120115
registerDevToolsEventLogger('extension');
121116

122-
function onDuplicateExtensionMessage(message) {
123-
if (message === SHOW_DUPLICATE_EXTENSION_WARNING) {
124-
chrome.runtime.onMessage.removeListener(
125-
onDuplicateExtensionMessage,
126-
);
127-
128-
if (warnIfDuplicateInstallation === true) {
129-
return;
130-
}
131-
warnIfDuplicateInstallation = true;
132-
const errorMessage =
133-
'React Developer Tools: We detected that there are multiple versions of React Developer Tools ' +
134-
'installed and enabled in your browser at the same time, which will cause ' +
135-
'issues while using the extension. ' +
136-
'Please ensure that you have installed and enabled only a single ' +
137-
'version of React Developer Tools before proceeding.';
138-
console.error(errorMessage);
139-
chrome.devtools.inspectedWindow.eval(
140-
`console.error("${errorMessage}")`,
141-
);
142-
if (render != null) {
143-
render();
144-
}
145-
}
146-
}
147-
chrome.runtime.onMessage.addListener(onDuplicateExtensionMessage);
148-
149117
function initBridgeAndStore() {
150118
const port = chrome.runtime.connect({
151119
name: String(tabId),
@@ -407,7 +375,6 @@ function createPanelIfReactLoaded() {
407375
hookNamesModuleLoaderFunction,
408376
overrideTab,
409377
profilerPortalContainer,
410-
warnIfDuplicateInstallation,
411378
showTabBar: false,
412379
store,
413380
warnIfUnsupportedVersionDetected: true,

packages/react-devtools-shared/src/devtools/views/DevTools.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {SchedulingProfilerContextController} from 'react-devtools-scheduling-pro
3434
import {ModalDialogContextController} from './ModalDialog';
3535
import ReactLogo from './ReactLogo';
3636
import UnsupportedBridgeProtocolDialog from './UnsupportedBridgeProtocolDialog';
37-
import DuplicateInstallationDialog from './DuplicateInstallationDialog';
3837
import UnsupportedVersionDialog from './UnsupportedVersionDialog';
3938
import WarnIfLegacyBackendDetected from './WarnIfLegacyBackendDetected';
4039
import {useLocalStorage} from './hooks';
@@ -74,7 +73,6 @@ export type Props = {|
7473
enabledInspectedElementContextMenu?: boolean,
7574
showTabBar?: boolean,
7675
store: Store,
77-
warnIfDuplicateInstallation?: boolean,
7876
warnIfLegacyBackendDetected?: boolean,
7977
warnIfUnsupportedVersionDetected?: boolean,
8078
viewAttributeSourceFunction?: ?ViewAttributeSource,
@@ -134,7 +132,6 @@ export default function DevTools({
134132
profilerPortalContainer,
135133
showTabBar = false,
136134
store,
137-
warnIfDuplicateInstallation = false,
138135
warnIfLegacyBackendDetected = false,
139136
warnIfUnsupportedVersionDetected = false,
140137
viewAttributeSourceFunction,
@@ -322,7 +319,6 @@ export default function DevTools({
322319
</ViewElementSourceContext.Provider>
323320
</SettingsContextController>
324321
<UnsupportedBridgeProtocolDialog />
325-
{warnIfDuplicateInstallation && <DuplicateInstallationDialog />}
326322
{warnIfLegacyBackendDetected && <WarnIfLegacyBackendDetected />}
327323
{warnIfUnsupportedVersionDetected && <UnsupportedVersionDialog />}
328324
</ModalDialogContextController>

packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js

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

0 commit comments

Comments
 (0)