Please review 8150219: ReferenceError in 1.8.0_72: Bug: https://bugs.openjdk.java.net/browse/JDK-8150219 Webrev: http://cr.openjdk.java.net/~hannesw/8150219/webrev.00/
This is a bit of a compromise that partially restores the behavior we had before JDK-8138616 by associating a ScriptContext with a Nashorn Global, but only in the very specific case where a script is evaluated with a non-default ScriptContext that does not have a Nashorn Global yet, and the Global is created for that specific ScriptContext. Also, we use the existing setScriptContext method and ThreadLocal field in Global instead of introducing an extra field as we had it before. The purpose is to make functions obtained from such globals use the ScriptContext they were evaluated with. Thanks, Hannes