Skip to content

Commit

Permalink
Only show DevTools warning about unrecognized build in Chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Tejada committed Oct 15, 2021
1 parent e5f486b commit 361542c
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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. ' +
Expand Down Expand Up @@ -76,14 +78,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;
}
Expand Down

0 comments on commit 361542c

Please sign in to comment.