Closed Bug 1158463 Opened 5 years ago Closed 5 years ago

Reorder property creation in js::FromPropertyDescriptorToObject

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: anba, Assigned: evilpie)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

More or less the same as bug 737198, except Object.getOwnPropertyNames instead of Object.keys is used, and ES2015 specifies to preserve property creation order.

Object.getOwnPropertyNames(Object.getOwnPropertyDescriptor({foo: 0}, "foo"))

Expected: [ "value", "writable", "enumerable", "configurable" ]
Actual: [ "configurable", "enumerable", "value", "writable" ]


Object.getOwnPropertyNames(Object.getOwnPropertyDescriptor({get foo(){}}, "foo"))

Expected: [ "get", "set", "enumerable", "configurable" ]
Actual: [ "configurable", "enumerable", "get", "set" ]


ES2015:
6.2.4.4 FromPropertyDescriptor
9.1.12 [[OwnPropertyKeys]] ( )
19.1.2.8.1 Runtime Semantics: GetOwnPropertyKeys ( O, Type )
Blocks: es6
Assignee: nobody → evilpies
Attachment #8597610 - Flags: review?(jwalden+bmo)
Comment on attachment 8597610 [details] [diff] [review]
v1 - Use the right property order in FromPropertyDescriptor

Review of attachment 8597610 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/tests/ecma_6/Object/property-descriptor-order.js
@@ +11,5 @@
> +        return true;
> +    }
> +});
> +
> +Object.defineProperty(proxy, "foo", {set: function() {}, configurable: true});

Put configurable first, then set second, here -- to verify that we've gone through FromPropertyDescriptor or so here, and aren't simply transliterating directly from the descriptor object provided to Object.defineProperty.
Attachment #8597610 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/a240e100cb2a
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.