Skip to content

Commit

Permalink
check for process object
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Jun 22, 2015
1 parent 7c21f3f commit 93a7c8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source-map-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ function isInBrowser() {
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function'));
}

function hasGlobalProcessEventEmitter() {
return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
}

function retrieveFile(path) {
// Trim the path to make sure there is no extra whitespace.
path = path.trim();
Expand Down Expand Up @@ -418,7 +422,7 @@ exports.install = function(options) {
// exception handler and the process will still be terminated. However, the
// generated JavaScript code will be shown above the stack trace instead of
// the original source code.
if (installHandler && !isInBrowser()) {
if (installHandler && hasGlobalProcessEventEmitter()) {
shimEmitUncaughtException();
}
}
Expand Down

0 comments on commit 93a7c8a

Please sign in to comment.