src/jdk/nashorn/internal/runtime/ScriptFunctionData.java
Print this page
*** 30,39 ****
--- 30,40 ----
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
+ import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
/**
* A container for data needed to instantiate a specific {@link ScriptFunction} at runtime.
* Instances of this class are created during codegen and stored in script classes'
*** 370,384 ****
* @return the converted this object
*/
private Object convertThisObject(final Object thiz) {
if (!(thiz instanceof ScriptObject) && needsWrappedThis()) {
if (JSType.nullOrUndefined(thiz)) {
! return Context.getGlobalTrusted();
}
if (isPrimitiveThis(thiz)) {
! return ((GlobalObject)Context.getGlobalTrusted()).wrapAsObject(thiz);
}
}
return thiz;
}
--- 371,385 ----
* @return the converted this object
*/
private Object convertThisObject(final Object thiz) {
if (!(thiz instanceof ScriptObject) && needsWrappedThis()) {
if (JSType.nullOrUndefined(thiz)) {
! return Context.getGlobal();
}
if (isPrimitiveThis(thiz)) {
! return Context.getGlobal().wrapAsObject(thiz);
}
}
return thiz;
}