Linus Groh
33eea1f722
LibJS: Fix Object.prototype.valueOf() behavior
...
No idea why it was implemented like this, but a value_of() call on the
coerced object is not part of the spec. Also added some tests.
2021-06-13 01:06:36 +01:00
Idan Horowitz
bd9e20ef79
LibJS: Add the Object.getOwnPropertySymbols method
2021-06-12 18:39:23 +01:00
Idan Horowitz
a2da3f97ef
LibJS: Remove argument count checks in Object.* methods
...
These are inconsistent with the specification.
2021-06-12 18:39:23 +01:00
Linus Groh
7e1bffdeb8
LibJS: Implement Object.assign()
2021-06-12 11:36:17 +01:00
Linus Groh
4e555fae22
LibJS: Add missing cyclic prototype check to Object.setPrototypeOf()
2021-06-07 22:56:16 +01:00
Andreas Kling
3ee092cd0c
LibJS: Implement Object.hasOwn() :^)
...
This is currently a TC39 Stage 2 proposal, but let's go for it!
https://github.com/tc39/proposal-accessible-object-hasownproperty
I wrote the C++, @linusg found bugs and wrote the test.
2021-05-18 11:18:19 +02:00
Linus Groh
7af1d2c170
LibJS: Make Object.getOwnPropertyDescriptor() work with string indexed property
...
E.g. for "0" we have to contruct a PropertyName with Type::Number so it
looks in the indexed properties as expected.
2021-04-20 18:53:07 +02:00
Linus Groh
614bad86bc
LibJS: Fix Object.getOwnPropertyDescriptor() attributes for numeric property
...
We were getting the attributes of the existing value and then
immediately assigned the default attributes instead.
2021-04-20 18:42:10 +02:00
Linus Groh
ac3e7ef791
LibJS: Fix crash in Object.{freeze,seal}() with indexed properties
...
This was failing to take two things into account:
- When constructing a PropertyName from a value, it won't automatically
convert to Type::Number for something like string "0", even though
that's how things work internally, since indexed properties are stored
separately. This will be improved in a future patch, it's a footgun
and should happen automatically.
- Those can't be looked up on the shape, we have to go through the
indexed properties instead.
Additionally it now operates on the shape or indexed properties directly
as define_property() was overly strict and would throw if a property was
already non-configurable.
Fixes #6469 .
2021-04-20 09:38:22 +02:00
Idan Horowitz
fff7aceb9d
LibJS: Accept symbol property in ObjectPrototype::hasOwnProperty
...
This is used by discord.com and allowed by the specification
(https://tc39.es/ecma262/#sec-topropertykey )
2021-04-16 19:22:29 +02:00
Linus Groh
9cd010167a
LibJS: Implement Object.create()
2021-04-10 21:00:04 +02:00
Linus Groh
da8a35a79e
LibJS: Implement Object.defineProperties()
2021-04-10 21:00:04 +02:00
Linus Groh
f3264b0dbd
LibJS: Implement Object.isFrozen() and Object.isSealed()
2021-04-07 09:05:01 +02:00
Linus Groh
9af07c7803
LibJS: Implement Object.freeze() and Object.seal()
2021-04-07 09:05:01 +02:00
Andreas Kling
13d7c09125
Libraries: Move to Userland/Libraries/
2021-01-12 12:17:46 +01:00