Distributive-Network / PythonMonkey

A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.
https://pythonmonkey.io
Other
855 stars 40 forks source link

Fix(console): extra stack property is printed after the stack trace #300

Closed Xmader closed 8 months ago

Xmader commented 8 months ago

The util.format code looks up all its own enumerable properties by Object.keys() then prints them out.

In SpiderMonkey, when changing the stack property of an Error object, stack becomes an enumerable property, while V8 doesn't. Our util.inspect/util.format code was copied from Node.js, so it won't handle the difference.

According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack#value, the stack property is implementation dependent.

philippedistributive commented 8 months ago

Would adding a test make sense?