Skip to content

Commit 17d0e0b

Browse files
jochenbergerthebigredgeek
authored andcommitted
check for navigator (#376)
Fix: navigator undefined in Rhino
1 parent 50ffa9d commit 17d0e0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ function useColors() {
5151
(typeof window !== 'undefined' && window.console && (console.firebug || (console.exception && console.table))) ||
5252
// is firefox >= v31?
5353
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
54-
(navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
54+
(navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
5555
// double check webkit in userAgent just in case we are in a worker
56-
(navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
56+
(navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
5757
}
5858

5959
/**

0 commit comments

Comments
 (0)