src/jdk/nashorn/internal/runtime/JSType.java
Print this page
@@ -34,10 +34,11 @@
import java.util.Deque;
import java.util.List;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
+import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.parser.Lexer;
import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
import jdk.nashorn.internal.runtime.linker.Bootstrap;
/**
@@ -850,11 +851,11 @@
* @param obj the object to convert
*
* @return the wrapped object
*/
public static Object toScriptObject(final Object obj) {
- return toScriptObject(Context.getGlobalTrusted(), obj);
+ return toScriptObject(Context.getGlobal(), obj);
}
/**
* Object conversion. This is used to convert objects and numbers to their corresponding
* NativeObject type
@@ -863,20 +864,20 @@
* @param global the global object
* @param obj the object to convert
*
* @return the wrapped object
*/
- public static Object toScriptObject(final ScriptObject global, final Object obj) {
+ public static Object toScriptObject(final Global global, final Object obj) {
if (nullOrUndefined(obj)) {
throw typeError(global, "not.an.object", ScriptRuntime.safeToString(obj));
}
if (obj instanceof ScriptObject) {
return obj;
}
- return ((GlobalObject)global).wrapAsObject(obj);
+ return global.wrapAsObject(obj);
}
/**
* Script object to Java array conversion.
*
@@ -982,11 +983,11 @@
}
if (obj instanceof ScriptObject) {
if (safe) {
final ScriptObject sobj = (ScriptObject)obj;
- final GlobalObject gobj = (GlobalObject)Context.getGlobalTrusted();
+ final Global gobj = Context.getGlobal();
return gobj.isError(sobj) ?
ECMAException.safeToString(sobj) :
sobj.safeToString();
}