/// <summary> /// 'thisObj' will be null if invoked as constructor, in which case /// instance of Scriptable should be returned. /// </summary> /// <remarks> /// 'thisObj' will be null if invoked as constructor, in which case /// instance of Scriptable should be returned. /// </remarks> public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args) { throw f.Unknown(); }
public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args) { if (f.HasTag(FTAG)) { if (f.MethodId() == Id_getClass) { return Js_getClass(cx, scope, args); } } throw f.Unknown(); }
public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args) { if (f.HasTag(FTAG)) { if (f.MethodId() == Id_constructor) { throw Context.ReportRuntimeError1("msg.cant.call.indirect", "With"); } } throw f.Unknown(); }
public virtual object ExecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, object[] args) { if (f.HasTag(FTAG)) { int methodId = f.MethodId(); switch (methodId) { case Id_decodeURI: case Id_decodeURIComponent: { string str = ScriptRuntime.ToString(args, 0); return Decode(str, methodId == Id_decodeURI); } case Id_encodeURI: case Id_encodeURIComponent: { string str = ScriptRuntime.ToString(args, 0); return Encode(str, methodId == Id_encodeURI); } case Id_escape: { return Js_escape(args); } case Id_eval: { return Js_eval(cx, scope, args); } case Id_isFinite: { bool result; if (args.Length < 1) { result = false; } else { double d = ScriptRuntime.ToNumber(args[0]); result = (d == d && d != double.PositiveInfinity && d != double.NegativeInfinity); } return ScriptRuntime.WrapBoolean(result); } case Id_isNaN: { // The global method isNaN, as per ECMA-262 15.1.2.6. bool result; if (args.Length < 1) { result = true; } else { double d = ScriptRuntime.ToNumber(args[0]); result = (d != d); } return ScriptRuntime.WrapBoolean(result); } case Id_isXMLName: { object name = (args.Length == 0) ? Undefined.instance : args[0]; XMLLib xmlLib = XMLLib.ExtractFromScope(scope); return ScriptRuntime.WrapBoolean(xmlLib.IsXMLName(cx, name)); } case Id_parseFloat: { return Js_parseFloat(args); } case Id_parseInt: { return Js_parseInt(args); } case Id_unescape: { return Js_unescape(args); } case Id_uneval: { object value = (args.Length != 0) ? args[0] : Undefined.instance; return ScriptRuntime.Uneval(cx, scope, value); } case Id_new_CommonError: { // The implementation of all the ECMA error constructors // (SyntaxError, TypeError, etc.) return NativeError.Make(cx, scope, f, args); } } } throw f.Unknown(); }