@samitouri / QOS-React / commits / 8890db707b

Don't suggest downloading React DevTools inside Chrome extension (#10359)

Dan Abramov committed Aug 2, 2017 at 20:04 UTC 8890db707bd9cf535ccb5cbbfa87a7f4564fe399
1 file changed +14 -11
src/renderers/dom/fiber/ReactDOMFiberEntry.js
+14 -11
@@ -825,17 +825,20 @@ if (__DEV__) {
825 navigator.userAgent.indexOf('Edge') === -1) ||
826 navigator.userAgent.indexOf('Firefox') > -1
827 ) {
828 - var showFileUrlMessage = window.location.protocol.indexOf('http') === -1;
829 - console.info(
830 - '%cDownload the React DevTools ' +
831 - 'for a better development experience: ' +
832 - 'https://fb.me/react-devtools' +
833 - (showFileUrlMessage
834 - ? '\nYou might need to use a local HTTP server (instead of file://): ' +
835 - 'https://fb.me/react-devtools-faq'
836 - : ''),
837 - 'font-weight:bold',
838 - );
828 + const protocol = window.location.protocol;
829 + // Don't warn in exotic cases like chrome-extension://.
830 + if (/^(https?|file):$/.test(protocol)) {
831 + console.info(
832 + '%cDownload the React DevTools ' +
833 + 'for a better development experience: ' +
834 + 'https://fb.me/react-devtools' +
835 + (protocol === 'file:'
836 + ? '\nYou might need to use a local HTTP server (instead of file://): ' +
837 + 'https://fb.me/react-devtools-faq'
838 + : ''),
839 + 'font-weight:bold',
840 + );
841 + }
842 }
843 }
844 }