Skip to content

Commit b72dc8e

Browse files
author
Juan
authored
Only show DevTools warning about unrecognized build in Chrome (facebook#22571)
1 parent e5f486b commit b72dc8e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

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

+14-8
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
declare var chrome: any;
1111

1212
import {__DEBUG__} from 'react-devtools-shared/src/constants';
13+
import {getBrowserName} from './utils';
1314
import {
1415
EXTENSION_INSTALL_CHECK,
1516
EXTENSION_INSTALLATION_TYPE,
1617
INTERNAL_EXTENSION_ID,
1718
LOCAL_EXTENSION_ID,
1819
} from './constants';
1920

21+
const IS_CHROME = getBrowserName() === 'Chrome';
22+
2023
const UNRECOGNIZED_EXTENSION_ERROR =
2124
'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. ' +
2225
'Please make sure you only have a single version of the extension installed or enabled. ' +
@@ -76,14 +79,17 @@ export function checkForDuplicateInstallations(callback: boolean => void) {
7679
break;
7780
}
7881
case 'unknown': {
79-
// If we don't know how this extension was built, we can't reliably detect if there
80-
// are other installations of DevTools present.
81-
// In this case, assume there are no duplicate exensions and show a warning about
82-
// potential conflicts.
83-
console.error(UNRECOGNIZED_EXTENSION_ERROR);
84-
chrome.devtools.inspectedWindow.eval(
85-
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
86-
);
82+
// TODO: Support duplicate extension detection in other browsers
83+
if (IS_CHROME) {
84+
// If we don't know how this extension was built, we can't reliably detect if there
85+
// are other installations of DevTools present.
86+
// In this case, assume there are no duplicate exensions and show a warning about
87+
// potential conflicts.
88+
console.error(UNRECOGNIZED_EXTENSION_ERROR);
89+
chrome.devtools.inspectedWindow.eval(
90+
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
91+
);
92+
}
8793
callback(false);
8894
break;
8995
}

0 commit comments

Comments
 (0)