diff --git a/src/client/app/widgets/common/widget.js b/src/client/app/widgets/common/widget.js index c9d599de..8ec2ea19 100644 --- a/src/client/app/widgets/common/widget.js +++ b/src/client/app/widgets/common/widget.js @@ -610,7 +610,7 @@ class Widget extends EventEmitter { }) } catch (err) { - var stackline = err.stack ? err.stack.match(/>:([0-9]+):[0-9]+/) : '', + var stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '', line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : '' console.log(this.getProp('id') + '.' + propName + ': JS{{}} error:\n' + err + line) } diff --git a/src/client/app/widgets/utils.js b/src/client/app/widgets/utils.js index 1ac0a2d0..6e2f6293 100644 --- a/src/client/app/widgets/utils.js +++ b/src/client/app/widgets/utils.js @@ -120,12 +120,13 @@ module.exports = { loopProtect.hit = function(line){ throw 'Potential infinite loop found on line ' + line } - sandbox.contentWindow.parsers = {} + + sandbox.contentWindow.__parsers = {} sandbox.contentWindow.__protect = loopProtect function evaljs(code, defaultContext) { - sandbox.contentWindow.parsers[code] = sandbox.contentWindow.Function( + sandbox.contentWindow.__parsers[code] = sandbox.contentWindow.Function( loopProtect('"use strict";' + code) .replace(/;\n(if \(__protect.*break;)\n/g, ';$1') // prevent loop protect from breaking stack linenumber ) @@ -141,7 +142,7 @@ module.exports = { // evaluate try { - ret = sandbox.contentWindow.parsers[code]() + ret = sandbox.contentWindow.__parsers[code]() } catch(e) { err = e }