in src/main/java/org/apache/sling/scripting/sightly/js/impl/rhino/JsUtils.java [30:42]
public static Object callFn(Function function, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) {
boolean exitContext = false;
if (Context.getCurrentContext() == null) {
Context.enter();
exitContext = true;
}
Context context = (cx == null) ? Context.getCurrentContext() : cx;
Object result = function.call(context, scope, thisObj, args);
if (exitContext) {
Context.exit();
}
return result;
}