Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The length property of an array is enumerable #971

Closed
tofpie opened this issue Dec 16, 2020 · 4 comments · Fixed by #972
Closed

The length property of an array is enumerable #971

tofpie opened this issue Dec 16, 2020 · 4 comments · Fixed by #972
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Milestone

Comments

@tofpie
Copy link
Contributor

tofpie commented Dec 16, 2020

Describe the bug
The length property of an array is enumerable, but it should not.

To Reproduce
This JavaScript code reproduces the issue:

>> [].propertyIsEnumerable("length")
true

Expected behavior
[].propertyIsEnumerable("length") should be false.

Build environment

  • OS: Windows 10
  • Version: 0.10
  • Target triple: x86_64-pc-windows-msvc
  • Rustc version: rustc 1.48.0 (7eac88abb 2020-11-16)

Additional context
None

@tofpie tofpie added the bug Something isn't working label Dec 16, 2020
@tofpie
Copy link
Contributor Author

tofpie commented Dec 16, 2020

I have taken a look, but I have not found anything obvious. I would be happy to fix it, but I do not know the code so well and I would need some guidance.

@Razican Razican added the builtins PRs and Issues related to builtins/intrinsics label Dec 16, 2020
@Razican Razican added this to the v0.11.0 milestone Dec 16, 2020
@Razican
Copy link
Member

Razican commented Dec 16, 2020

I believe this is set up here: https://github.com/boa-dev/boa/blob/master/boa/src/builtins/array/mod.rs#L61

The issue is that we are using Attribute::all(), which will sett all types to true as per https://github.com/boa-dev/boa/blob/470dbb43818dc7658a45a011856584fe60220662/boa/src/property/attribute/mod.rs

I think it should use Attribute::default().

@Razican
Copy link
Member

Razican commented Dec 16, 2020

Actually, not, since it should be writable as per this, so we should probably select the right attribute.

The spec: https://tc39.es/ecma262/#sec-properties-of-array-instances-length

@tofpie
Copy link
Contributor Author

tofpie commented Dec 16, 2020

It seems this is another bug. This causes:

>> Array.prototype.propertyIsEnumerable("length")
true

This should be false. Maybe I can add the fix in the same PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants