mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Only show DevTools warning about unrecognized build in Chrome (#22571)
This commit is contained in:
parent
e5f486b5a8
commit
b72dc8e930
|
|
@ -10,6 +10,7 @@
|
|||
declare var chrome: any;
|
||||
|
||||
import {__DEBUG__} from 'react-devtools-shared/src/constants';
|
||||
import {getBrowserName} from './utils';
|
||||
import {
|
||||
EXTENSION_INSTALL_CHECK,
|
||||
EXTENSION_INSTALLATION_TYPE,
|
||||
|
|
@ -17,6 +18,8 @@ import {
|
|||
LOCAL_EXTENSION_ID,
|
||||
} from './constants';
|
||||
|
||||
const IS_CHROME = getBrowserName() === 'Chrome';
|
||||
|
||||
const UNRECOGNIZED_EXTENSION_ERROR =
|
||||
'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. ' +
|
||||
'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) {
|
|||
break;
|
||||
}
|
||||
case 'unknown': {
|
||||
// If we don't know how this extension was built, we can't reliably detect if there
|
||||
// are other installations of DevTools present.
|
||||
// In this case, assume there are no duplicate exensions and show a warning about
|
||||
// potential conflicts.
|
||||
console.error(UNRECOGNIZED_EXTENSION_ERROR);
|
||||
chrome.devtools.inspectedWindow.eval(
|
||||
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
|
||||
);
|
||||
// TODO: Support duplicate extension detection in other browsers
|
||||
if (IS_CHROME) {
|
||||
// If we don't know how this extension was built, we can't reliably detect if there
|
||||
// are other installations of DevTools present.
|
||||
// In this case, assume there are no duplicate exensions and show a warning about
|
||||
// potential conflicts.
|
||||
console.error(UNRECOGNIZED_EXTENSION_ERROR);
|
||||
chrome.devtools.inspectedWindow.eval(
|
||||
`console.error("${UNRECOGNIZED_EXTENSION_ERROR}")`,
|
||||
);
|
||||
}
|
||||
callback(false);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user