private static ObjToIntMap getObjectFunctionNames(Scriptable obj) { Object[] ids = ScriptableObject.getPropertyIds(obj); ObjToIntMap map = new ObjToIntMap(ids.length); for (int i = 0; i != ids.length; ++i) { if (!(ids[i] instanceof String)) continue; String id = (String) ids[i]; Object value = ScriptableObject.getProperty(obj, id); if (value instanceof Function) { Function f = (Function)value; int length = ScriptRuntime.toInt32( ScriptableObject.getProperty(f, "length")); if (length < 0) { length = 0; } map.put(id, length); } } return map; }
/** * Creates a new event instance. * * @param target the event target * @param type the event type * @param state the state object */ public PopStateEvent(final EventTarget target, final String type, final Object state) { super(target, type); if (state instanceof NativeObject && getBrowserVersion().hasFeature(JS_POP_STATE_EVENT_CLONE_STATE)) { final NativeObject old = (NativeObject) state; final NativeObject newState = new NativeObject(); Context.enter(); try { for (final Object o : ScriptableObject.getPropertyIds(old)) { final String property = Context.toString(o); newState.defineProperty(property, ScriptableObject.getProperty(old, property), ScriptableObject.EMPTY); } } finally { Context.exit(); } state_ = newState; } else { state_ = state; } }
/** * Creates a new event instance. * * @param target the event target * @param type the event type * @param state the state object */ public PopStateEvent(final EventTarget target, final String type, final Object state) { super(target, type); if (state instanceof NativeObject && getBrowserVersion().hasFeature(JS_POP_STATE_EVENT_CLONE_STATE)) { final NativeObject old = (NativeObject) state; final NativeObject newState = new NativeObject(); Context.enter(); try { for (final Object o : ScriptableObject.getPropertyIds(old)) { final String property = Context.toString(o); newState.defineProperty(property, ScriptableObject.getProperty(old, property), ScriptableObject.EMPTY); } } finally { Context.exit(); } state_ = newState; } else { state_ = state; } }
Object[] ids = ScriptableObject.getPropertyIds(envHash); environment = new String[ids.length]; for (int i = 0; i != ids.length; ++i) {