check for navigator (#376)

Fix: navigator undefined in Rhino
This commit is contained in:
jochenberger 2016-12-18 08:02:18 +01:00 committed by Andrew E. Rhyne
parent 50ffa9d85e
commit 17d0e0bb49

View File

@ -51,9 +51,9 @@ function useColors() {
(typeof window !== 'undefined' && window.console && (console.firebug || (console.exception && console.table))) ||
// is firefox >= v31?
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
(navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
(navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
// double check webkit in userAgent just in case we are in a worker
(navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
(navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
}
/**