1. /* global chrome */
    
  2. 
    
  3. import {
    
  4.   getAppendComponentStack,
    
  5.   getBreakOnConsoleErrors,
    
  6.   getSavedComponentFilters,
    
  7.   getShowInlineWarningsAndErrors,
    
  8.   getHideConsoleLogsInStrictMode,
    
  9. } from 'react-devtools-shared/src/utils';
    
  10. import {getBrowserTheme} from 'react-devtools-extensions/src/utils';
    
  11. 
    
  12. // The renderer interface can't read saved component filters directly,
    
  13. // because they are stored in localStorage within the context of the extension.
    
  14. // Instead it relies on the extension to pass filters through.
    
  15. function syncSavedPreferences() {
    
  16.   chrome.devtools.inspectedWindow.eval(
    
  17.     `window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ = ${JSON.stringify(
    
  18.       getAppendComponentStack(),
    
  19.     )};
    
  20.     window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ = ${JSON.stringify(
    
  21.       getBreakOnConsoleErrors(),
    
  22.     )};
    
  23.     window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = ${JSON.stringify(
    
  24.       getSavedComponentFilters(),
    
  25.     )};
    
  26.     window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ = ${JSON.stringify(
    
  27.       getShowInlineWarningsAndErrors(),
    
  28.     )};
    
  29.     window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ = ${JSON.stringify(
    
  30.       getHideConsoleLogsInStrictMode(),
    
  31.     )};
    
  32.     window.__REACT_DEVTOOLS_BROWSER_THEME__ = ${JSON.stringify(
    
  33.       getBrowserTheme(),
    
  34.     )};`,
    
  35.   );
    
  36. }
    
  37. 
    
  38. export default syncSavedPreferences;