NeilFraser / JS-Interpreter

A sandboxed JavaScript interpreter in JavaScript.
Apache License 2.0
1.98k stars 353 forks source link

Unconstructable native functions should not have a .prototype property #176

Closed cpcallen closed 4 years ago

cpcallen commented 4 years ago

Functions marked as .illegalConstructor = true by Interpreter.prototype.createNativeFunction end up with a vestigial, non-enumerable but extant .prototype property (set to undefined). In reality, they should not have a .prototype property at all.

(The two situations can be distinguished by Object.getOwnPropertyDescriptor.)