parsers: error log hint and explicit setTimout/Interval fail

This commit is contained in:
jean-emmanuel 2019-04-08 09:53:30 +02:00
parent 48c1aa01c4
commit 87509e6a41
2 changed files with 6 additions and 2 deletions

View file

@ -599,7 +599,7 @@ class Widget extends EventEmitter {
return typeof r != 'string' ? JSON.stringify(r) : r
})
} catch (err) {
propValue = 'ERROR'
propValue = 'ERROR (F12)'
console.log(this.getProp('id') + '.' + propName + ': #{} error:\n' + err)
}
@ -616,7 +616,7 @@ class Widget extends EventEmitter {
})
} catch (err) {
propValue = 'ERROR'
propValue = 'ERROR (F12)'
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)

View file

@ -132,6 +132,10 @@ module.exports = {
parsers = {}
sandbox.contentWindow.console = console
sandbox.contentWindow.setTimeout =
sandbox.contentWindow.setInterval = ()=>{
throw 'setTimeout and setInterval can\'t be used in formulas'
}
sandbox.contentWindow.global = {}
document.documentElement.removeChild(sandbox)