Only show DevTools warning about unrecognized build in Chrome (#22571)
Juan committed
Oct 15, 2021 at 17:18 UTC
b72dc8e9300f5ae997f7f5cfcd79b604cca3df0c
1 file changed
+14
-8
packages/react-devtools-extensions/src/checkForDuplicateInstallations.js
+14
-8
@@ -10,6 +10,7 @@
10
declare var chrome: any;
11
12
import {__DEBUG__} from 'react-devtools-shared/src/constants';
13
+import {getBrowserName} from './utils';
14
import {
15
EXTENSION_INSTALL_CHECK,
16
EXTENSION_INSTALLATION_TYPE,
@@ -17,6 +18,8 @@ import {
18
LOCAL_EXTENSION_ID,
19
} from './constants';
20
21
+const IS_CHROME = getBrowserName() === 'Chrome';
22
+
23
const UNRECOGNIZED_EXTENSION_ERROR =
24
'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. ' +
25
'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) {
79
break;
80
}
81
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
+ }
93
callback(false);
94
break;
95
}