Open Bug 1629803 Opened 1 year ago Updated 8 months ago

Lazily resolved properties for functions break expected property order

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

Test262 failures because we're lazily creating the "name" and "length" properties of functions, which breaks the expected property iteration order:

test262/built-ins/Object/keys/order-after-define-property.js
test262/built-ins/Object/entries/order-after-define-property.js
test262/language/computed-property-names/class/static/method-number.js
test262/language/computed-property-names/class/static/method-string.js
test262/language/computed-property-names/class/static/method-symbol.js

Yes... we used to have a lot of resolve hooks and they all had this problem.

The general fix (apart from doing away with resolve hooks) would be to keep these properties lazy, but lazily create them in the right order, so that the list of properties physically present is always a prefix of what the spec says and what users must observe to be there.

Priority: -- → P3
Severity: -- → S3

Do we just change the order in which they are called here in the FunctionEmitter constructor?

https://searchfox.org/mozilla-central/source/js/src/frontend/FunctionEmitter.cpp#40

Noob question: In which file would the work be done for this bug?

Flags: needinfo?(jorendorff)

I think the change needs to be made in fun_resolve, in vm/JSFunction.cpp.

Flags: needinfo?(jorendorff)
You need to log in before you can comment on or make changes to this bug.