From e56c936798177543a6b3966698b616b0586f14fa Mon Sep 17 00:00:00 2001 From: damencho Date: Tue, 5 Apr 2016 17:18:38 -0500 Subject: [PATCH 1/2] Enables global error handler. --- conference.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conference.js b/conference.js index c68857899..e8523f1f8 100644 --- a/conference.js +++ b/conference.js @@ -316,6 +316,9 @@ export default { this.roomName = options.roomName; JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE); + // attaches global error handler + window.onerror = JitsiMeetJS.getGlobalOnErrorHandler; + return JitsiMeetJS.init(config).then(() => { return Promise.all([ // try to retrieve audio and video From ccc9f4e0332b5af63934b772bc7cbad5fce4f9d1 Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 6 Apr 2016 11:52:31 -0500 Subject: [PATCH 2/2] Adds a check and reuses any previous onerror handlers if they exist. --- conference.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/conference.js b/conference.js index e8523f1f8..447859c5b 100644 --- a/conference.js +++ b/conference.js @@ -316,8 +316,18 @@ export default { this.roomName = options.roomName; JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE); - // attaches global error handler - window.onerror = JitsiMeetJS.getGlobalOnErrorHandler; + // attaches global error handler, if there is already one, respect it + if(JitsiMeetJS.getGlobalOnErrorHandler){ + var oldOnErrorHandler = window.onerror; + window.onerror = function (message, source, lineno, colno, error) { + + JitsiMeetJS.getGlobalOnErrorHandler( + message, source, lineno, colno, error); + + if(oldOnErrorHandler) + oldOnErrorHandler(message, source, lineno, colno, error); + }; + } return JitsiMeetJS.init(config).then(() => { return Promise.all([