src/jdk/nashorn/api/scripting/ScriptUtils.java
Print this page
*** 23,32 ****
--- 23,34 ----
* questions.
*/
package jdk.nashorn.api.scripting;
+ import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
import java.lang.invoke.MethodHandle;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.internal.dynalink.linker.LinkerServices;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ScriptFunction;
*** 67,82 ****
/**
* Create a wrapper function that calls {@code func} synchronized on {@code sync} or, if that is undefined,
* {@code self}. Used to implement "sync" function in resources/mozilla_compat.js.
*
! * @param func the function to invoke
* @param sync the object to synchronize on
* @return a synchronizing wrapper function
*/
! public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
! return func.makeSynchronizedFunction(sync);
}
/**
* Make a script object mirror on given object if needed.
*
--- 69,85 ----
/**
* Create a wrapper function that calls {@code func} synchronized on {@code sync} or, if that is undefined,
* {@code self}. Used to implement "sync" function in resources/mozilla_compat.js.
*
! * @param func the function to wrap
* @param sync the object to synchronize on
* @return a synchronizing wrapper function
*/
! public static Object makeSynchronizedFunction(final Object func, final Object sync) {
! return func instanceof ScriptFunction?
! ((ScriptFunction)func).makeSynchronizedFunction(sync) : UNDEFINED;
}
/**
* Make a script object mirror on given object if needed.
*