NeilFraser / JS-Interpreter

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

Property descriptors returned by Object.getOwnPropertyDescriptor are not alert()able #177

Closed cpcallen closed 4 years ago

cpcallen commented 4 years ago

Attempting to eval

alert(Object.getOwnPropertyDescriptor(eval, 'prototype'));

throws

Uncaught TypeError: this.isa is not a function
    at Interpreter.Object.toString (interpreter.js:1956)
    at Interpreter.Object.wrapper ((index):21)
    at Interpreter.stepCallExpression (interpreter.js:3219)
    at Interpreter.step (interpreter.js:252)
    at Interpreter.run (interpreter.js:276)
NeilFraser commented 4 years ago

Aha, that's what the "unneeded" Error class was for!

https://github.com/NeilFraser/JS-Interpreter/commit/0178a4b75d0a20f87761e12636c25871252eb0d0

Reverting and documenting.