+1 Nice solution, of course much simpler than what I proposed below :)
Hannes > Am 01.12.2016 um 13:48 schrieb Sundararajan Athijegannathan > <sundararajan.athijegannat...@oracle.com>: > > Good catch Hannes! Please review the updated webrev : > http://cr.openjdk.java.net/~sundar/8170565/webrev.01/ > > PS. Had to use Function.prototype.call.call to pass undefined this explicitly > (as JSObject.call can't be called from script). > > -Sundar > > On 01/12/16, 3:13 PM, Hannes Wallnöfer wrote: >> Hi Sundar, >> >> The problem with this approach is that it will replace any occurrence of >> undefined this with the global object. However, this should only occur for >> scope calls. For example, the following call would see undefined replaced >> with global: >> >> func.call(undefined) >> >> This is probably not a problem that will occur very often, but ideally I >> think we should do the check and replacement on the linking side, i.e. in >> JSObjectLinker.findCallMethod. >> >> On the other hand we can’t check for function strictness that way. Maybe do >> it your way but add a boolean isScope parameter and bind that at link time? >> >> Hannes >> >> >>> Am 01.12.2016 um 07:21 schrieb Sundararajan >>> Athijegannathan<sundararajan.athijegannat...@oracle.com>: >>> >>> Please review http://cr.openjdk.java.net/~sundar/8170565/webrev.00/ for >>> https://bugs.openjdk.java.net/browse/JDK-8170565 >>> >>> Thanks, >>> -Sundar