To understand details, I followed whole steps.
Then, I faced the problem:
6.2.5.4 FromPropertyDescriptor
3. Assert: obj is an extensible ordinary object with no own properties.
- If Desc has a [[Writable]] field, then
a. Perform ! CreateDataPropertyOrThrow(obj, "writable", Desc.[[Writable]]).
and...following steps:
CreateDataPropertyOrThrow(obj, "writable", Desc.[[Writable]]).
newDesc = PropertyDescriptor { [[Value]]: Desc.[[Writable]], [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true }.
obj.[[DefineOwnProperty]]("writable", newDesc).
OrdinaryDefineOwnProperty ( obj, "writable", newDesc )
- Let current be ? O.[GetOwnProperty].
obj.[GetOwnProperty]
-2. If O does not have an own property with key P, return undefined.
(==obj does not have an own property with key "writable" )
Therefore, current be undefined
- Let extensible be ? IsExtensible(O).
(==assume as true because of 6.2.5.4.3)
ValidateAndApplyPropertyDescriptor ( obj, "writable", true|false, newDesc , undefined )
- Assert: If O is not undefined, then IsPropertyKey(P) is true.
(==Therefore, It’s true)
- If current is undefined, then
- a. If extensible is false, return false. [No]
- b. Assert: extensible is true. [Yes, assumed as true]
- c. If IsGenericDescriptor(Desc) is true or IsDataDescriptor(Desc) is true, then
- i. If O is not undefined, create an own data property named P of object O whose [[Value]], [[Writable]], [[Enumerable]], and [[Configurable]] attribute values are described by Desc. If the value of an attribute field of Desc is absent, the attribute of the newly created property is set to its default value.
- Because IsDataDescriptor(newDesc) is true, do above.
- e. Return true.
conclusion...
The result would be
obj = {“writable”: true}
And getOwnDescriptor of it would be newDesc
What 's the fault? I am doubtful that I was really mistaken.