Skip to content

Commit 2fed713

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 c0bd1e0 commit 2fed713

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
@@ -11,13 +11,13 @@ declare var chrome: any;
1111

1212
import {__DEBUG__} from 'react-devtools-shared/src/constants';
1313
import {
14-
EXTENSION_INSTALL_CHECK,
14+
EXTENSION_INSTALL_CHECK_MESSAGE,
1515
EXTENSION_INSTALLATION_TYPE,
1616
INTERNAL_EXTENSION_ID,
1717
LOCAL_EXTENSION_ID,
1818
} from './constants';
1919

20-
const UNRECOGNIZED_EXTENSION_ERROR =
20+
const UNRECOGNIZED_EXTENSION_WARNING =
2121
'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. ' +
2222
'Please make sure you only have a single version of the extension installed or enabled. ' +
2323
'If you are developing this extension locally, make sure to build the extension using the `yarn build:<browser>:local` command.';
@@ -68,9 +68,9 @@ export function checkForDuplicateInstallations(callback: boolean => void) {
6868
// detect if there are other installations of DevTools present.
6969
// In this case, assume there are no duplicate exensions and show a warning about
7070
// potential conflicts.
71-
console.error(UNRECOGNIZED_EXTENSION_ERROR);
71+
console.error(UNRECOGNIZED_EXTENSION_WARNING);
7272
chrome.devtools.inspectedWindow.eval(
73-
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
73+
`console.error("${UNRECOGNIZED_EXTENSION_WARNING}")`,
7474
);
7575
callback(false);
7676
break;
@@ -80,9 +80,9 @@ export function checkForDuplicateInstallations(callback: boolean => void) {
8080
// are other installations of DevTools present.
8181
// In this case, assume there are no duplicate exensions and show a warning about
8282
// potential conflicts.
83-
console.error(UNRECOGNIZED_EXTENSION_ERROR);
83+
console.error(UNRECOGNIZED_EXTENSION_WARNING);
8484
chrome.devtools.inspectedWindow.eval(
85-
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
85+
`console.error("${UNRECOGNIZED_EXTENSION_WARNING}")`,
8686
);
8787
callback(false);
8888
break;
@@ -105,7 +105,7 @@ function checkForInstalledExtension(extensionId: string): Promise<boolean> {
105105
return new Promise(resolve => {
106106
chrome.runtime.sendMessage(
107107
extensionId,
108-
EXTENSION_INSTALL_CHECK,
108+
EXTENSION_INSTALL_CHECK_MESSAGE,
109109
response => {
110110
if (__DEBUG__) {
111111
console.log(

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

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

1212
export const CURRENT_EXTENSION_ID = chrome.runtime.id;
1313

14-
export const EXTENSION_INSTALL_CHECK = 'extension-install-check';
15-
export const SHOW_DUPLICATE_EXTENSION_WARNING =
16-
'show-duplicate-extension-warning';
14+
export const EXTENSION_INSTALL_CHECK_MESSAGE = 'extension-install-check';
1715

1816
export const CHROME_WEBSTORE_EXTENSION_ID = 'fmkadmapgofadopljbjfkapdkoienihi';
1917
export const INTERNAL_EXTENSION_ID = 'dnjnjgbfilfphmojnmhliehogmojhclc';

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 =
@@ -112,39 +108,11 @@ function createPanelIfReactLoaded() {
112108
let mostRecentOverrideTab = null;
113109
let render = null;
114110
let root = null;
115-
let warnIfDuplicateInstallation = false;
116111

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

119114
registerDevToolsEventLogger('extension');
120115

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