private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
private static void reportWarning(Context cx, String messageId, String arg) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { String msg = ScriptRuntime.getMessage1(messageId, arg); Context.reportWarning(msg); } }
static Ref createSpecial(Context cx, Object object, String name) { Scriptable target = ScriptRuntime.toObjectOrNull(cx, object); if (target == null) { throw ScriptRuntime.undefReadError(object, name); } int type; if (name.equals("__proto__")) { type = SPECIAL_PROTO; } else if (name.equals("__parent__")) { type = SPECIAL_PARENT; } else { throw new IllegalArgumentException(name); } if (!cx.hasFeature(Context.FEATURE_PARENT_PROTO_PROPERTIES)) { // Clear special after checking for valid name! type = SPECIAL_NONE; } return new SpecialRef(target, type, name); }
static Ref createSpecial(Context cx, Scriptable scope, Object object, String name) { Scriptable target = ScriptRuntime.toObjectOrNull(cx, object, scope); if (target == null) { throw ScriptRuntime.undefReadError(object, name); } int type; if (name.equals("__proto__")) { type = SPECIAL_PROTO; } else if (name.equals("__parent__")) { type = SPECIAL_PARENT; } else { throw new IllegalArgumentException(name); } if (!cx.hasFeature(Context.FEATURE_PARENT_PROTO_PROPERTIES)) { // Clear special after checking for valid name! type = SPECIAL_NONE; } return new SpecialRef(target, type, name); }
static Ref createSpecial(Context cx, Object object, String name) { Scriptable target = ScriptRuntime.toObjectOrNull(cx, object); if (target == null) { throw ScriptRuntime.undefReadError(object, name); } int type; if (name.equals("__proto__")) { type = SPECIAL_PROTO; } else if (name.equals("__parent__")) { type = SPECIAL_PARENT; } else { throw new IllegalArgumentException(name); } if (!cx.hasFeature(Context.FEATURE_PARENT_PROTO_PROPERTIES)) { // Clear special after checking for valid name! type = SPECIAL_NONE; } return new SpecialRef(target, type, name); }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }
JavaMembers(Scriptable scope, Class<?> cl, boolean includeProtected) { try { Context cx = ContextFactory.getGlobal().enterContext(); ClassShutter shutter = cx.getClassShutter(); if (shutter != null && !shutter.visibleToScripts(cl.getName())) { throw Context.reportRuntimeError1("msg.access.prohibited", cl.getName()); } this.includePrivate = cx.hasFeature( Context.FEATURE_ENHANCED_JAVA_ACCESS); this.members = new HashMap<String,Object>(); this.staticMembers = new HashMap<String,Object>(); this.cl = cl; reflect(scope, includeProtected); } finally { Context.exit(); } }
JavaMembers(Scriptable scope, Class<?> cl, boolean includeProtected) { try { Context cx = ContextFactory.getGlobal().enterContext(); ClassShutter shutter = cx.getClassShutter(); if (shutter != null && !shutter.visibleToScripts(cl.getName())) { throw Context.reportRuntimeError1("msg.access.prohibited", cl.getName()); } this.members = new HashMap<String,Object>(); this.staticMembers = new HashMap<String,Object>(); this.cl = cl; boolean includePrivate = cx.hasFeature( Context.FEATURE_ENHANCED_JAVA_ACCESS); reflect(scope, includeProtected, includePrivate); } finally { Context.exit(); } }
JavaMembers(Scriptable scope, Class<?> cl, boolean includeProtected) { try { Context cx = ContextFactory.getGlobal().enterContext(); ClassShutter shutter = cx.getClassShutter(); if (shutter != null && !shutter.visibleToScripts(cl.getName())) { throw Context.reportRuntimeError1("msg.access.prohibited", cl.getName()); } this.members = new HashMap<String,Object>(); this.staticMembers = new HashMap<String,Object>(); this.cl = cl; boolean includePrivate = cx.hasFeature( Context.FEATURE_ENHANCED_JAVA_ACCESS); reflect(scope, includeProtected, includePrivate); } finally { Context.exit(); } }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { if (obj instanceof XMLObject) { XMLObject xmlObject = (XMLObject)obj; return xmlObject.ecmaGet(cx, property); } Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }
/** * Report a warning using the error reporter for the current thread. * * @param message the warning message to report * @param sourceName a string describing the source, such as a filename * @param lineno the starting line number * @param lineSource the text of the line (may be null) * @param lineOffset the offset into lineSource where problem was detected * @see org.mozilla.javascript.ErrorReporter */ public static void reportWarning(String message, String sourceName, int lineno, String lineSource, int lineOffset) { Context cx = Context.getContext(); if (cx.hasFeature(FEATURE_WARNING_AS_ERROR)) reportError(message, sourceName, lineno, lineSource, lineOffset); else cx.getErrorReporter().warning(message, sourceName, lineno, lineSource, lineOffset); }
/** * Report a warning using the error reporter for the current thread. * * @param message the warning message to report * @param sourceName a string describing the source, such as a filename * @param lineno the starting line number * @param lineSource the text of the line (may be null) * @param lineOffset the offset into lineSource where problem was detected * @see org.mozilla.javascript.ErrorReporter */ public static void reportWarning(String message, String sourceName, int lineno, String lineSource, int lineOffset) { Context cx = Context.getContext(); if (cx.hasFeature(FEATURE_WARNING_AS_ERROR)) reportError(message, sourceName, lineno, lineSource, lineOffset); else cx.getErrorReporter().warning(message, sourceName, lineno, lineSource, lineOffset); }
public static Object getObjectProp(Scriptable obj, String property, Context cx) { if (obj instanceof XMLObject) { // TODO: Change XMLObject to just use Scriptable interface // to avoid paying cost of instanceof check on *every property // lookup* ! XMLObject xmlObject = (XMLObject)obj; return xmlObject.ecmaGet(cx, property); } Object result = ScriptableObject.getProperty(obj, property); if (result == Scriptable.NOT_FOUND) { if (cx.hasFeature(Context.FEATURE_STRICT_MODE)) { Context.reportWarning(ScriptRuntime.getMessage1( "msg.ref.undefined.prop", property)); } result = Undefined.instance; } return result; }