File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -40,20 +40,20 @@ function useColors() {
4040 // NB: In an Electron preload script, document will be defined but not fully
4141 // initialized. Since we know we're in Chrome, we'll just detect this case
4242 // explicitly
43- if ( window && window . process && window . process . type === 'renderer' ) {
43+ if ( typeof window !== 'undefined' && window . process && window . process . type === 'renderer' ) {
4444 return true ;
4545 }
4646
4747 // is webkit? http://stackoverflow.com/a/16459606/376773
4848 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
49- return ( document && document . documentElement && document . documentElement . style && document . documentElement . style . WebkitAppearance ) ||
49+ return ( typeof document !== 'undefined' && document . documentElement && document . documentElement . style && document . documentElement . style . WebkitAppearance ) ||
5050 // is firebug? http://stackoverflow.com/a/398120/376773
51- ( window && window . console && ( window . console . firebug || ( window . console . exception && window . console . table ) ) ) ||
51+ ( typeof window !== 'undefined' && window . console && ( window . console . firebug || ( window . console . exception && window . console . table ) ) ) ||
5252 // is firefox >= v31?
5353 // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
54- ( navigator && navigator . userAgent && navigator . userAgent . toLowerCase ( ) . match ( / f i r e f o x \/ ( \d + ) / ) && parseInt ( RegExp . $1 , 10 ) >= 31 ) ||
54+ ( typeof navigator !== 'undefined' && navigator . userAgent && navigator . userAgent . toLowerCase ( ) . match ( / f i r e f o x \/ ( \d + ) / ) && parseInt ( RegExp . $1 , 10 ) >= 31 ) ||
5555 // double check webkit in userAgent just in case we are in a worker
56- ( navigator && navigator . userAgent && navigator . userAgent . toLowerCase ( ) . match ( / a p p l e w e b k i t \/ ( \d + ) / ) ) ;
56+ ( typeof navigator !== 'undefined' && navigator . userAgent && navigator . userAgent . toLowerCase ( ) . match ( / a p p l e w e b k i t \/ ( \d + ) / ) ) ;
5757}
5858
5959/**
You can’t perform that action at this time.
0 commit comments