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); }