When the getOwnPropertyDescriptors function is called, the following steps are taken:
- Let obj be ToObject(O).
- ReturnIfAbrupt(obj).
- Let keys be the result of calling the [[OwnPropertyKeys]] internal method of obj.
- ReturnIfAbrupt(keys).
- Let descriptors be the result of the abstract operation ObjectCreate with the intrinsic object %ObjectPrototype% as its argument.
- Let gotAllNames be false.
- Repeat while gotAllNames is false,
1. Let next be the result of IteratorStep(keys).
1. ReturnIfAbrupt( next ).
1. If next is false, then let gotAllNames be true.
1. Else,
- Let nextKey be IteratorValue(next).
- Let nextKey be ToPropertyKey(nextKey).
- ReturnIfAbrupt(nextKey).
- Let desc be the result of calling the [[GetOwnProperty]] internal method of obj with argument nextKey.
- ReturnIfAbrupt(desc).
- Let descriptor be FromPropertyDescriptor(desc).
- ReturnIfAbrupt(descriptor).
- Let status be the result of CreateDataProperty(descriptors, nextKey, descriptor).
- Assert: status is not an abrupt completion.
- Return descriptors.
Would you mind adding an example? I always find those tremendously helpful in proposals.