From 93a7c8a22ef194085b05e85273b5d7e48e044301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Tue, 16 Jun 2015 15:38:59 +0200 Subject: [PATCH] check for process object --- source-map-support.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source-map-support.js b/source-map-support.js index 82259df..7500296 100644 --- a/source-map-support.js +++ b/source-map-support.js @@ -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(); @@ -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(); } }