Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as React from 'react';
import * as styles from './cssStyles';
import { cx, css } from 'emotion';
import { TabItem } from '../tabWindow';
import * as utils from '../utils';
import { HEADER_BUTTON_SIZE } from './constants';
import { Theme } from './themeContext';
import * as svg from './svg';
import { inExtension } from '../utils';
import { initSimpleImg, SimpleImg } from 'react-simple-img';
const nodeEnv = process.env.NODE_ENV;
if (nodeEnv === 'development') {
// only log errors in dev mode:
initSimpleImg(undefined, undefined, true);
}
const emptyFavIconStyle = cx(styles.headerButton, styles.emptyFavIcon);
const favIconOpenStyle = styles.favIcon;
const favIconClosedStyle = cx(styles.favIcon, styles.favIconClosed);
const httpFavIconUrl = (url: string | null): string => {
let fiSrc = '';
if (url) {
const urlinfo = utils.parseURL(url);
if (urlinfo.host) {
fiSrc = 'https://www.google.com/s2/favicons?domain=' + urlinfo.host;
}
}
return fiSrc;
};