private void xmlMethodNotFound(Object object, String name) { throw ScriptRuntime.notFunctionError(object, name); }
private void xmlMethodNotFound(Object object, String name) { throw ScriptRuntime.notFunctionError(object, name); }
/** * Operator new. * * See ECMA 11.2.2 */ public static Scriptable newObject(Object fun, Context cx, Scriptable scope, Object[] args) { if (!(fun instanceof Function)) { throw notFunctionError(fun); } Function function = (Function)fun; return function.construct(cx, scope, args); }
/** * Operator new. * * See ECMA 11.2.2 */ public static Scriptable newObject(Object fun, Context cx, Scriptable scope, Object[] args) { if (!(fun instanceof Function)) { throw notFunctionError(fun); } Function function = (Function)fun; return function.construct(cx, scope, args); }
static Callable getCallable(Scriptable thisObj) { Callable function; if (thisObj instanceof Callable) { function = (Callable)thisObj; } else { Object value = thisObj.getDefaultValue(ScriptRuntime.FunctionClass); if (!(value instanceof Callable)) { throw ScriptRuntime.notFunctionError(value, thisObj); } function = (Callable)value; } return function; }
static Callable getCallable(Scriptable thisObj) { Callable function; if (thisObj instanceof Callable) { function = (Callable)thisObj; } else { Object value = thisObj.getDefaultValue(ScriptRuntime.FunctionClass); if (!(value instanceof Callable)) { throw ScriptRuntime.notFunctionError(value, thisObj); } function = (Callable)value; } return function; }
static Callable getCallable(Scriptable thisObj) { Callable function; if (thisObj instanceof Callable) { function = (Callable)thisObj; } else { Object value = thisObj.getDefaultValue(ScriptRuntime.FunctionClass); if (!(value instanceof Callable)) { throw ScriptRuntime.notFunctionError(value, thisObj); } function = (Callable)value; } return function; }
/** * Operator new. * * See ECMA 11.2.2 */ public static Scriptable newObject(Object fun, Context cx, Scriptable scope, Object[] args) { if (!(fun instanceof Function)) { throw notFunctionError(fun); } Function function = (Function)fun; return function.construct(cx, scope, args); }
static Callable getCallable(Scriptable thisObj) { Callable function; if (thisObj instanceof Callable) { function = (Callable)thisObj; } else { Object value = thisObj.getDefaultValue(ScriptRuntime.FunctionClass); if (!(value instanceof Callable)) { throw ScriptRuntime.notFunctionError(value, thisObj); } function = (Callable)value; } return function; }
public static Function getFunction(Scriptable obj, String functionName) { Object x = ScriptableObject.getProperty(obj, functionName); if (x == Scriptable.NOT_FOUND) { // This method used to swallow the exception from calling // an undefined method. People have come to depend on this // somewhat dubious behavior. It allows people to avoid // implementing listener methods that they don't care about, // for instance. return null; } if (!(x instanceof Function)) throw ScriptRuntime.notFunctionError(x, functionName); return (Function)x; }
/** * Operator new. * * See ECMA 11.2.2 */ public static Scriptable newObject(Object fun, Context cx, Scriptable scope, Object[] args) { if (!(fun instanceof Function)) { throw notFunctionError(fun); } Function function = (Function)fun; return function.construct(cx, scope, args); }
static Callable getCallable(Scriptable thisObj) { Callable function; if (thisObj instanceof Callable) { function = (Callable)thisObj; } else { Object value = thisObj.getDefaultValue(ScriptRuntime.FunctionClass); if (!(value instanceof Callable)) { throw ScriptRuntime.notFunctionError(value, thisObj); } function = (Callable)value; } return function; }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // XXX Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, value == null ? "null" : value.getClass().getName()); }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, typeof(value)); }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, typeof(value)); }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, typeof(value)); }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, typeof(value)); }
public static RuntimeException notFunctionError(Object value, Object messageHelper) { // Use value for better error reporting String msg = (messageHelper == null) ? "null" : messageHelper.toString(); if (value == Scriptable.NOT_FOUND) { return typeError1("msg.function.not.found", msg); } return typeError2("msg.isnt.function", msg, typeof(value)); }
protected void checkPropertyDefinition(ScriptableObject desc) { Object getter = getProperty(desc, "get"); if (getter != NOT_FOUND && getter != Undefined.instance && !(getter instanceof Callable)) { throw ScriptRuntime.notFunctionError(getter); } Object setter = getProperty(desc, "set"); if (setter != NOT_FOUND && setter != Undefined.instance && !(setter instanceof Callable)) { throw ScriptRuntime.notFunctionError(setter); } if (isDataDescriptor(desc) && isAccessorDescriptor(desc)) { throw ScriptRuntime.typeError0("msg.both.data.and.accessor.desc"); } }
/** * @deprecated The method is only present for compatibility. */ public static Object call(Context cx, Object fun, Object thisArg, Object[] args, Scriptable scope) { if (!(fun instanceof Function)) { throw notFunctionError(toString(fun)); } Function function = (Function)fun; Scriptable thisObj = toObjectOrNull(cx, thisArg); if (thisObj == null) { throw undefCallError(thisObj, "function"); } return function.call(cx, scope, thisObj, args); }