| 320 | | JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSObjectRef object) |
| 321 | | { |
| 322 | | JSLock lock; |
| 323 | | JSObject* jsObject = toJS(object); |
| 324 | | |
| 325 | | JSPropertyEnumeratorRef enumerator = new __JSPropertyEnumerator(); |
| 326 | | jsObject->getPropertyList(enumerator->list); |
| 327 | | enumerator->iterator = enumerator->list.begin(); |
| 328 | | |
| 329 | | return JSPropertyEnumeratorRetain(enumerator); |
| 330 | | } |
| 331 | | |
| 332 | | JSStringRef JSPropertyEnumeratorGetNextName(JSPropertyEnumeratorRef enumerator) |
| 333 | | { |
| 334 | | ReferenceListIterator& iterator = enumerator->iterator; |
| 335 | | if (iterator != enumerator->list.end()) { |
| 336 | | JSStringRef result = toRef(iterator->getPropertyName().ustring().rep()); |
| 337 | | iterator++; |
| 338 | | return result; |
| 339 | | } |
| 340 | | return 0; |
| 341 | | } |
| 342 | | |
| 343 | | JSPropertyEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyEnumeratorRef enumerator) |
| 344 | | { |
| 345 | | ++enumerator->refCount; |
| 346 | | return enumerator; |
| 347 | | } |
| 348 | | |
| 349 | | void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator) |
| 350 | | { |
| 351 | | if (--enumerator->refCount == 0) |
| 352 | | delete enumerator; |
| 353 | | } |
| 354 | | |
| 355 | | void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSStringRef propertyName) |
| 356 | | { |
| 357 | | JSLock lock; |
| 358 | | ReferenceList* jsPropertyList = toJS(propertyList); |
| 359 | | JSObject* jsObject = toJS(thisObject); |
| | 319 | JSPropertyNameArrayRef JSObjectCopyPropertyNames(JSContextRef context, JSObjectRef object) |
| | 320 | { |
| | 321 | JSLock lock; |
| | 322 | JSObject* jsObject = toJS(object); |
| | 323 | ExecState* exec = toJS(context); |
| | 324 | |
| | 325 | JSPropertyNameArrayRef propertyNames = new __JSPropertyNameArray(); |
| | 326 | jsObject->getPropertyNames(exec, propertyNames->array); |
| | 327 | |
| | 328 | return JSPropertyNameArrayRetain(propertyNames); |
| | 329 | } |
| | 330 | |
| | 331 | JSPropertyNameArrayRef JSPropertyNameArrayRetain(JSPropertyNameArrayRef array) |
| | 332 | { |
| | 333 | ++array->refCount; |
| | 334 | return array; |
| | 335 | } |
| | 336 | |
| | 337 | void JSPropertyNameArrayRelease(JSPropertyNameArrayRef array) |
| | 338 | { |
| | 339 | if (--array->refCount == 0) |
| | 340 | delete array; |
| | 341 | } |
| | 342 | |
| | 343 | size_t JSPropertyNameArrayGetCount(JSPropertyNameArrayRef array) |
| | 344 | { |
| | 345 | return array->array.size(); |
| | 346 | } |
| | 347 | |
| | 348 | JSStringRef JSPropertyNameArrayGetNameAtIndex(JSPropertyNameArrayRef array, size_t index) |
| | 349 | { |
| | 350 | return toRef(array->array[index].ustring().rep()); |
| | 351 | } |
| | 352 | |
| | 353 | void JSPropertyNameAccumulatorAddName(JSPropertyNameAccumulatorRef array, JSStringRef propertyName) |
| | 354 | { |
| | 355 | JSLock lock; |
| | 356 | PropertyNameArray* propertyNames = toJS(array); |