Changeset 48568 in webkit for trunk/JavaScriptCore/runtime/ObjectConstructor.cpp
- Timestamp:
- Sep 19, 2009, 6:13:51 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ObjectConstructor.cpp
r48565 r48568 40 40 static JSValue JSC_HOST_CALL objectConstructorDefineProperty(ExecState*, JSObject*, JSValue, const ArgList&); 41 41 static JSValue JSC_HOST_CALL objectConstructorDefineProperties(ExecState*, JSObject*, JSValue, const ArgList&); 42 static JSValue JSC_HOST_CALL objectConstructorCreate(ExecState*, JSObject*, JSValue, const ArgList&); 42 43 43 44 ObjectConstructor::ObjectConstructor(ExecState* exec, PassRefPtr<Structure> structure, ObjectPrototype* objectPrototype, Structure* prototypeFunctionStructure) … … 55 56 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 3, exec->propertyNames().defineProperty, objectConstructorDefineProperty), DontEnum); 56 57 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().defineProperties, objectConstructorDefineProperties), DontEnum); 58 putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 2, exec->propertyNames().create, objectConstructorCreate), DontEnum); 57 59 } 58 60 … … 283 285 } 284 286 287 JSValue JSC_HOST_CALL objectConstructorCreate(ExecState* exec, JSObject*, JSValue, const ArgList& args) 288 { 289 if (!args.at(0).isObject() && !args.at(0).isNull()) 290 return throwError(exec, TypeError, "Object prototype may only be an Object or null."); 291 JSObject* newObject = constructEmptyObject(exec); 292 newObject->setPrototype(args.at(0)); 293 if (args.at(1).isUndefined()) 294 return newObject; 295 if (!args.at(1).isObject()) 296 return throwError(exec, TypeError, "Property descriptor list must be an Object."); 297 return defineProperties(exec, newObject, asObject(args.at(1))); 298 } 299 285 300 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.