public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
public static Scriptable newObject(Context cx, Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = getExistingCtor(cx, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(cx, scope, args); }
/** * Creates a new JavaScript object by executing the named constructor. * * Searches <code>scope</code> for the named constructor, calls it with * the given arguments, and returns the result.<p> * * The code * <pre> * Object[] args = { "a", "b" }; * newObject(scope, "Foo", args)</pre> * is equivalent to evaluating "new Foo('a', 'b')", assuming that the Foo * constructor has been defined in <code>scope</code>. * * @param scope The scope to search for the constructor and to evaluate * against * @param constructorName the name of the constructor to call * @param args the array of arguments for the constructor * @return the new object */ public final Scriptable newObject(Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = ScriptRuntime.getExistingCtor(this, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(this, scope, args); }
/** * Creates a new JavaScript object by executing the named constructor. * * Searches <code>scope</code> for the named constructor, calls it with * the given arguments, and returns the result.<p> * * The code * <pre> * Object[] args = { "a", "b" }; * newObject(scope, "Foo", args)</pre> * is equivalent to evaluating "new Foo('a', 'b')", assuming that the Foo * constructor has been defined in <code>scope</code>. * * @param scope The scope to search for the constructor and to evaluate * against * @param constructorName the name of the constructor to call * @param args the array of arguments for the constructor * @return the new object */ public Scriptable newObject(Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = ScriptRuntime.getExistingCtor(this, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(this, scope, args); }
/** * Creates a new JavaScript object by executing the named constructor. * * Searches <code>scope</code> for the named constructor, calls it with * the given arguments, and returns the result.<p> * * The code * <pre> * Object[] args = { "a", "b" }; * newObject(scope, "Foo", args)</pre> * is equivalent to evaluating "new Foo('a', 'b')", assuming that the Foo * constructor has been defined in <code>scope</code>. * * @param scope The scope to search for the constructor and to evaluate * against * @param constructorName the name of the constructor to call * @param args the array of arguments for the constructor * @return the new object */ public Scriptable newObject(Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = ScriptRuntime.getExistingCtor(this, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(this, scope, args); }
/** * Creates a new JavaScript object by executing the named constructor. * * Searches <code>scope</code> for the named constructor, calls it with * the given arguments, and returns the result.<p> * * The code * <pre> * Object[] args = { "a", "b" }; * newObject(scope, "Foo", args)</pre> * is equivalent to evaluating "new Foo('a', 'b')", assuming that the Foo * constructor has been defined in <code>scope</code>. * * @param scope The scope to search for the constructor and to evaluate * against * @param constructorName the name of the constructor to call * @param args the array of arguments for the constructor * @return the new object */ public final Scriptable newObject(Scriptable scope, String constructorName, Object[] args) { scope = ScriptableObject.getTopLevelScope(scope); Function ctor = ScriptRuntime.getExistingCtor(this, scope, constructorName); if (args == null) { args = ScriptRuntime.emptyArgs; } return ctor.construct(this, scope, args); }
/** * Static helper method to get a native error constructor with the given * <code>type</code> from the given <code>scope</code>. If the scope is not * an instance of this class or does have a cache of native errors, * the constructor is looked up via normal property lookup. * * @param cx the current Context * @param scope the top-level scope * @param type the native error type * @return the native error constructor */ static Function getNativeErrorCtor(Context cx, Scriptable scope, NativeErrors type) { // must be called with top level scope assert scope.getParentScope() == null; if (scope instanceof TopLevel) { Function result = ((TopLevel)scope).getNativeErrorCtor(type); if (result != null) { return result; } } // fall back to normal constructor lookup return ScriptRuntime.getExistingCtor(cx, scope, type.name()); }
/** * Static helper method to get a built-in object constructor with the given * <code>type</code> from the given <code>scope</code>. If the scope is not * an instance of this class or does have a cache of built-ins, * the constructor is looked up via normal property lookup. * * @param cx the current Context * @param scope the top-level scope * @param type the built-in type * @return the built-in constructor */ public static Function getBuiltinCtor(Context cx, Scriptable scope, Builtins type) { // must be called with top level scope assert scope.getParentScope() == null; if (scope instanceof TopLevel) { Function result = ((TopLevel)scope).getBuiltinCtor(type); if (result != null) { return result; } } // fall back to normal constructor lookup return ScriptRuntime.getExistingCtor(cx, scope, type.name()); }
/** * Static helper method to get a built-in object constructor with the given * <code>type</code> from the given <code>scope</code>. If the scope is not * an instance of this class or does have a cache of built-ins, * the constructor is looked up via normal property lookup. * * @param cx the current Context * @param scope the top-level scope * @param type the built-in type * @return the built-in constructor */ public static Function getBuiltinCtor(Context cx, Scriptable scope, Builtins type) { // must be called with top level scope assert scope.getParentScope() == null; if (scope instanceof TopLevel) { Function result = ((TopLevel)scope).getBuiltinCtor(type); if (result != null) { return result; } } // fall back to normal constructor lookup return ScriptRuntime.getExistingCtor(cx, scope, type.name()); }
/** * Static helper method to get a built-in object constructor with the given * <code>type</code> from the given <code>scope</code>. If the scope is not * an instance of this class or does have a cache of built-ins, * the constructor is looked up via normal property lookup. * * @param cx the current Context * @param scope the top-level scope * @param type the built-in type * @return the built-in constructor */ public static Function getBuiltinCtor(Context cx, Scriptable scope, Builtins type) { // must be called with top level scope assert scope.getParentScope() == null; if (scope instanceof TopLevel) { Function result = ((TopLevel)scope).getBuiltinCtor(type); if (result != null) { return result; } } // fall back to normal constructor lookup return ScriptRuntime.getExistingCtor(cx, scope, type.name()); }
/** * Static helper method to get a built-in object constructor with the given * <code>type</code> from the given <code>scope</code>. If the scope is not * an instance of this class or does have a cache of built-ins, * the constructor is looked up via normal property lookup. * * @param cx the current Context * @param scope the top-level scope * @param type the built-in type * @return the built-in constructor */ public static Function getBuiltinCtor(Context cx, Scriptable scope, Builtins type) { // must be called with top level scope assert scope.getParentScope() == null; if (scope instanceof TopLevel) { Function result = ((TopLevel)scope).getBuiltinCtor(type); if (result != null) { return result; } } // fall back to normal constructor lookup return ScriptRuntime.getExistingCtor(cx, scope, type.name()); }
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array"); Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs); if (thisObj instanceof NativeArray && result instanceof NativeArray) {
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array"); Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs); if (thisObj instanceof NativeArray && result instanceof NativeArray) {
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array"); Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs); if (thisObj instanceof NativeArray && result instanceof NativeArray) {
Function ctor = ScriptRuntime.getExistingCtor(cx, scope, "Array"); Scriptable result = ctor.construct(cx, scope, ScriptRuntime.emptyArgs); long length;