Restoring ScriptRuntime.call: BSF uses it!

This commit is contained in:
igor%mir2.org 2004-08-04 17:42:56 +00:00
parent 9b72dd5b6f
commit 0cf7fb3e59

View File

@ -839,6 +839,23 @@ public class ScriptRuntime {
return toObject(cx, scope, val);
}
public static Object call(Context cx, Object fun, Object thisArg,
Object[] args, Scriptable scope)
throws JavaScriptException
{
if (!(fun instanceof Function)) {
throw notFunctionError(toString(fun));
}
Function function = (Function)fun;
Scriptable thisObj;
if (thisArg instanceof Scriptable || thisArg == null) {
thisObj = (Scriptable) thisArg;
} else {
thisObj = ScriptRuntime.toObject(cx, scope, thisArg);
}
return function.call(cx, scope, thisObj, args);
}
public static Scriptable newObject(Context cx, Scriptable scope,
String constructorName, Object[] args)
{