mozilla / rhino

Rhino is an open-source implementation of JavaScript written entirely in Java
https://rhino.github.io
Other
4.19k stars 851 forks source link

Allow passing `Undefined.instance` to `ScriptRuntime.evalSpecial` #1714

Closed andreabergia closed 3 weeks ago

andreabergia commented 3 weeks ago

The method ScriptRuntime.evalSpecial takes a generic Object for thisArg. However, it then casts it to Scriptable. We have some (rare) code paths where we end up passing Undefined.instance to that method, where we get a ClassCastException. This simple PR allows it and adds a test.

gbrail commented 3 weeks ago

Looks good to me too -- thanks!