public boolean has(String id, Scriptable start) { return prototype.has(id, prototype); }
/** * @see net.sourceforge.htmlunit.corejs.javascript.Scriptable#has(String, Scriptable) */ public boolean has(String name, Scriptable start) { return obj.has(name,start); } /**
/** * @see net.sourceforge.htmlunit.corejs.javascript.Scriptable#has(int, Scriptable) */ public boolean has(int index, Scriptable start) { return obj.has(index,start); } /**
public boolean has(int index, Scriptable start) { return prototype.has(index, prototype); }
private static Scriptable getBase(Scriptable obj, String name) { do { if (obj.has(name, obj)) break; obj = obj.getPrototype(); } while(obj != null); return obj; }
private static Scriptable getBase(Scriptable obj, int index) { do { if (obj.has(index, obj)) break; obj = obj.getPrototype(); } while(obj != null); return obj; }
/** * Removes the property from an object or its prototype chain. * <p> * Searches for a property with <code>name</code> in obj or * its prototype chain. If it is found, the object's delete * method is called. * @param obj a JavaScript object * @param name a property name * @return true if the property doesn't exist or was successfully removed * @since 1.5R2 */ public static boolean deleteProperty(Scriptable obj, String name) { Scriptable base = getBase(obj, name); if (base == null) return true; base.delete(name); return !base.has(name, obj); }
/** * Removes the property from an object or its prototype chain. * <p> * Searches for a property with <code>index</code> in obj or * its prototype chain. If it is found, the object's delete * method is called. * @param obj a JavaScript object * @param index a property index * @return true if the property doesn't exist or was successfully removed * @since 1.5R2 */ public static boolean deleteProperty(Scriptable obj, int index) { Scriptable base = getBase(obj, index); if (base == null) return true; base.delete(index); return !base.has(index, obj); }
/** * {@inheritDoc} */ @Override public boolean has(final String name, final Scriptable start) { if (super.has(name, start)) { return true; } for (Class<?> c = getMethodOrConstructor().getDeclaringClass().getSuperclass(); c != null; c = c.getSuperclass()) { final Object scripatble = getParentScope().get(c.getSimpleName(), this); if (scripatble instanceof Scriptable && ((Scriptable) scripatble).has(name, start)) { return true; } } return false; }
/** * {@inheritDoc} */ @Override public boolean has(final String name, final Scriptable start) { if (super.has(name, start)) { return true; } for (Class<?> c = getMethodOrConstructor().getDeclaringClass().getSuperclass(); c != null; c = c.getSuperclass()) { final Object scripatble = getParentScope().get(c.getSimpleName(), this); if (scripatble instanceof Scriptable && ((Scriptable) scripatble).has(name, start)) { return true; } } return false; }
/** * {@inheritDoc} */ @Override public void put(final String name, final Scriptable start, final Object value) { // for java mocks do a bit more, we have handle unknown properties // ourself if (wrappedActiveX_ instanceof NativeJavaObject) { if (wrappedActiveX_.has(name, start)) { wrappedActiveX_.put(name, start, value); } else { super.put(name, start, value); } return; } if (wrappedActiveX_ != null) { wrappedActiveX_.put(name, start, value); return; } super.put(name, start, value); }
/** * {@inheritDoc} */ @Override public void put(final String name, final Scriptable start, final Object value) { // for java mocks do a bit more, we have handle unknown properties // ourself if (wrappedActiveX_ instanceof NativeJavaObject) { if (wrappedActiveX_.has(name, start)) { wrappedActiveX_.put(name, start, value); } else { super.put(name, start, value); } return; } if (wrappedActiveX_ != null) { wrappedActiveX_.put(name, start, value); return; } super.put(name, start, value); }
public static Object setDefaultNamespace(Object namespace, Context cx) { Scriptable scope = cx.currentActivationCall; if (scope == null) { scope = getTopCallScope(cx); } XMLLib xmlLib = currentXMLLib(cx); Object ns = xmlLib.toDefaultXmlNamespace(cx, namespace); // XXX : this should be in separated namesapce from Scriptable.get/put if (!scope.has(DEFAULT_NS_TAG, scope)) { // XXX: this is racy of cause ScriptableObject.defineProperty(scope, DEFAULT_NS_TAG, ns, ScriptableObject.PERMANENT | ScriptableObject.DONTENUM); } else { scope.put(DEFAULT_NS_TAG, scope, ns); } return Undefined.instance; }
if (s == null) { int index = ScriptRuntime.lastIndexResult(cx); result = thisObj.has(index, thisObj); } else { result = thisObj.has(s, thisObj); if (s == null) { int index = ScriptRuntime.lastIndexResult(cx); result = thisObj.has(index, thisObj); if (result && thisObj instanceof ScriptableObject) { ScriptableObject so = (ScriptableObject)thisObj; result = thisObj.has(s, thisObj); if (result && thisObj instanceof ScriptableObject) { ScriptableObject so = (ScriptableObject)thisObj;