askql
askql copied to clipboard
Calling a method named the same as an Object.prototype method results in a 'Cannot call null' error
Examples:
3:toString
3:toString()
'a':__defineGetter__
'a':__defineGetter__()
and other from Object.prototype
return in an error:
Uncaught Error: Cannot call null
Following our conversation in https://github.com/xFAANG/askql/issues/69:
Me:
I didn't know we allow accessing Javascript properties straight from AskVM. Is it safe?
mhagmajer:
@czerwinskilukasz1 we use object as the data structure for resources map. When you create an object in JavaScript using {} it derives all properties of Object.prototype. To avoid that you can use Object.create(null) but people really do as this is less convenient API