src/jdk/nashorn/internal/runtime/JSType.java

Print this page

        

*** 34,43 **** --- 34,44 ---- 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,860 **** * @param obj the object to convert * * @return the wrapped object */ public static Object toScriptObject(final Object obj) { ! return toScriptObject(Context.getGlobalTrusted(), obj); } /** * Object conversion. This is used to convert objects and numbers to their corresponding * NativeObject type --- 851,861 ---- * @param obj the object to convert * * @return the wrapped object */ public static Object toScriptObject(final Object obj) { ! return toScriptObject(Context.getGlobal(), obj); } /** * Object conversion. This is used to convert objects and numbers to their corresponding * NativeObject type
*** 863,882 **** * @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) { if (nullOrUndefined(obj)) { throw typeError(global, "not.an.object", ScriptRuntime.safeToString(obj)); } if (obj instanceof ScriptObject) { return obj; } ! return ((GlobalObject)global).wrapAsObject(obj); } /** * Script object to Java array conversion. * --- 864,883 ---- * @param global the global object * @param obj the object to convert * * @return the wrapped object */ ! 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 global.wrapAsObject(obj); } /** * Script object to Java array conversion. *
*** 982,992 **** } if (obj instanceof ScriptObject) { if (safe) { final ScriptObject sobj = (ScriptObject)obj; ! final GlobalObject gobj = (GlobalObject)Context.getGlobalTrusted(); return gobj.isError(sobj) ? ECMAException.safeToString(sobj) : sobj.safeToString(); } --- 983,993 ---- } if (obj instanceof ScriptObject) { if (safe) { final ScriptObject sobj = (ScriptObject)obj; ! final Global gobj = Context.getGlobal(); return gobj.isError(sobj) ? ECMAException.safeToString(sobj) : sobj.safeToString(); }