JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec, JSObject*, JSValue, const ArgList& args) { if (!args.at(0).isObject()) return throwError(exec, TypeError, "Properties can only be defined on Objects."); if (!args.at(1).isObject()) return throwError(exec, TypeError, "Property descriptor list must be an Object."); return defineProperties(exec, asObject(args.at(0)), asObject(args.at(1))); }
EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec) { if (!exec->argument(0).isObject()) return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects.")); if (!exec->argument(1).isObject()) return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object.")); return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), asObject(exec->argument(1)))); }
JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args) { if (!args.at(0).isObject() && !args.at(0).isNull()) return throwError(exec, TypeError, "Object prototype may only be an Object or null."); JSObject* newObject = constructEmptyObject(exec); newObject->setPrototype(args.at(0)); if (args.at(1).isUndefined()) return newObject; if (!args.at(1).isObject()) return throwError(exec, TypeError, "Property descriptor list must be an Object."); return defineProperties(exec, newObject, asObject(args.at(1))); }
EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec) { if (!exec->argument(0).isObject() && !exec->argument(0).isNull()) return throwVMError(exec, createTypeError(exec, "Object prototype may only be an Object or null.")); JSObject* newObject = constructEmptyObject(exec); newObject->setPrototype(exec->argument(0)); if (exec->argument(1).isUndefined()) return JSValue::encode(newObject); if (!exec->argument(1).isObject()) return throwVMError(exec, createTypeError(exec, "Property descriptor list must be an Object.")); return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1)))); }
EncodedJSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec) { if (!exec->argument(0).isObject() && !exec->argument(0).isNull()) return throwVMError(exec, createTypeError(exec, ASCIILiteral("Object prototype may only be an Object or null."))); JSValue proto = exec->argument(0); JSObject* newObject = proto.isObject() ? constructEmptyObject(exec, asObject(proto)) : constructEmptyObject(exec, exec->lexicalGlobalObject()->nullPrototypeObjectStructure()); if (exec->argument(1).isUndefined()) return JSValue::encode(newObject); if (!exec->argument(1).isObject()) return throwVMError(exec, createTypeError(exec, ASCIILiteral("Property descriptor list must be an Object."))); return JSValue::encode(defineProperties(exec, newObject, asObject(exec->argument(1)))); }
EncodedJSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState* exec) { if (!exec->argument(0).isObject()) return throwVMError(exec, createTypeError(exec, ASCIILiteral("Properties can only be defined on Objects."))); return JSValue::encode(defineProperties(exec, asObject(exec->argument(0)), exec->argument(1).toObject(exec))); }