|
10 | 10 | declare var chrome: any;
|
11 | 11 |
|
12 | 12 | import {__DEBUG__} from 'react-devtools-shared/src/constants';
|
| 13 | +import {getBrowserName} from './utils'; |
13 | 14 | import {
|
14 | 15 | EXTENSION_INSTALL_CHECK,
|
15 | 16 | EXTENSION_INSTALLATION_TYPE,
|
16 | 17 | INTERNAL_EXTENSION_ID,
|
17 | 18 | LOCAL_EXTENSION_ID,
|
18 | 19 | } from './constants';
|
19 | 20 |
|
| 21 | +const IS_CHROME = getBrowserName() === 'Chrome'; |
| 22 | + |
20 | 23 | const UNRECOGNIZED_EXTENSION_ERROR =
|
21 | 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. ' +
|
22 | 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) {
|
76 | 79 | break;
|
77 | 80 | }
|
78 | 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 | + } |
87 | 93 | callback(false);
|
88 | 94 | break;
|
89 | 95 | }
|
|
0 commit comments