1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibJS: Object.getOwnPropertyNames() should enumerate String's .length

We were incorrectly aborting property name enumeration after generating
names for all the indexable properties in the underlying string.
This commit is contained in:
Andreas Kling 2021-06-19 11:46:08 +02:00
parent 686213c2b8
commit f86e241699
2 changed files with 5 additions and 2 deletions

View file

@ -12,3 +12,8 @@ test("use with object with symbol keys", () => {
let names = Object.getOwnPropertyNames({ foo: 1, [Symbol("bar")]: 2, baz: 3 });
expect(names).toEqual(["foo", "baz"]);
});
test("use with String object", () => {
let names = Object.getOwnPropertyNames(new String("foo"));
expect(names).toEqual(["0", "1", "2", "length"]);
});