Skip to content

Commit 4e10be6

Browse files
committed
check for process object
1 parent 7c21f3f commit 4e10be6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

source-map-support.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ function isInBrowser() {
2121
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function'));
2222
}
2323

24+
function hasGlobalProcess() {
25+
return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
26+
}
27+
2428
function retrieveFile(path) {
2529
// Trim the path to make sure there is no extra whitespace.
2630
path = path.trim();
@@ -418,7 +422,7 @@ exports.install = function(options) {
418422
// exception handler and the process will still be terminated. However, the
419423
// generated JavaScript code will be shown above the stack trace instead of
420424
// the original source code.
421-
if (installHandler && !isInBrowser()) {
425+
if (installHandler && hasGlobalProcess()) {
422426
shimEmitUncaughtException();
423427
}
424428
}

0 commit comments

Comments
 (0)