1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 00:55:08 +00:00
Commit graph

3022 commits

Author SHA1 Message Date
Luke Wilde
05748ed607 LibJS: Convert Console to use MarkedVector<Value>
Using a Vector<Value> is unsafe as GC cannot see the stored values.
This is then vended to outside users of ConsoleClient, e.g. LibWeb and
WebContent, which is then outside of LibJS's control.

An example issue is if the client stores it for later use and forgets
to visit the stored values, meaning they can be destroyed at any time.
We can save the client from this by vending a MarkedVector<Value> to
them.
2022-05-07 01:22:09 +02:00
Linus Groh
f7c9bd0760 LibJS: Convert remaining Date AOs using JS::Value as in/output to double
There was an awful lot of JS::Value <-> double conversion going on, even
through these AOs only work with number values anyway.
They don't need a global object either as they won't allocate or throw,
that was simply to pass it to infallible calls of ToIntegerOrInfinity.
2022-05-06 22:32:47 +02:00
Linus Groh
b9b3d01bea LibJS: Add variant of to_integer_or_infinity() for plain doubles
In many cases we already know a certain value is a number, or don't have
JS values at all and would need to wrap doubles in a value. To optimize
these cases and avoid having to pass a global object into functions that
won't ever allocate or throw, add a standalone implementation of this
function that takes and returns doubles directly.
2022-05-06 22:32:47 +02:00
Linus Groh
875e59b740 LibJS: Remove unused LibCore/DateTime.h header from Date.cpp
We use a double for [[DateValue]] and the spec's own AOs for any
calculations now.
2022-05-06 22:32:47 +02:00
Linus Groh
4dd9102f5e LibJS: Move Hours/Minutes/Seconds/ms constants out of the Date class
They can remain in this header, but will be used outside the Date
context in Temporal.
2022-05-06 22:32:47 +02:00
Linus Groh
53619176f5 LibJS: Set "prototype" property of async generator functions 2022-05-05 22:40:57 +02:00
Linus Groh
09e263dd9c LibJS: Fix "prototype" property of generator functions, again
The change in 3ec0183 wasn't actually correct, the spec tells us to set
the "prototype" property of the function (created with a prototype of
%GeneratorFunction.prototype% itself) to a newly created object:
OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%)
2022-05-05 22:40:57 +02:00
Linus Groh
dd547c3374 LibJS: Add getters for %{Async,}GeneratorFunction.prototype.prototype%
These exist as {Async,}GeneratorPrototype of course, but the spec
doesn't always refer to them by the direct name.
2022-05-05 22:40:57 +02:00
Linus Groh
0c65624a32 LibJS: Add AsyncGenerator / AsyncGeneratorPrototype
Not implementing any prototype functions yet, but stubbing out async
generator infrastructure will allow us to make some progress in that
direction.
2022-05-05 22:40:57 +02:00
Linus Groh
2c68ec9097 LibJS: Use Object* for 'manual' GlobalObject::foo_prototype() getters
Not doing so only leads to problems down the line, e.g. not being able
to pass them as function pointers to ordinary_create_from_constructor().
2022-05-05 22:40:57 +02:00
Linus Groh
2fc9481bb6 LibJS: Correct SetMutableBinding fallibility bug in spec comment
This is an editorial change in the ECMA-262 spec.

See: 656f0cf
2022-05-05 09:28:08 +02:00
Linus Groh
50d0f879f7 LibJS: Remove bogus FIXME in ArgumentsObject::internal_get()
Not sure what happened here, but the comment does not match the spec,
and so the FIXME I added is not actually an issue.
2022-05-03 22:51:36 +02:00
Linus Groh
f3768705a9 LibJS: Use consistent phrasing for string length
This is an editorial change in the ECMA-262 spec.

See: 33ea99e
2022-05-03 22:49:31 +02:00
Linus Groh
8b035b80d3 LibJS: Update order of steps in CanonicalNumericIndexString
This is an editorial change in the ECMA-262 spec.

See: be5db32
2022-05-03 22:49:31 +02:00
Linus Groh
367e7b4fe5 LibJS: Reflect Array.prototype.toLocaleString comment in %TypedArray%
This is an editorial change in the ECMA-262 spec.

See: 2a9ed48
2022-05-03 22:49:31 +02:00
Linus Groh
b9bbf45a81 LibJS: Add assertion (comment) to MakeMatchIndicesIndexPairArray
This is an editorial change in the ECMA-262 spec.

See: caa6e3f
2022-05-03 22:49:31 +02:00
Linus Groh
ede932287f LibJS: Update spec comments to avoid = comparisons with signed zero
This is an editorial change in the ECMA-262 spec.

See: b7348e5
2022-05-03 22:49:31 +02:00
Linus Groh
257375f54c LibJS: Update comments for Annex B changes to IsLooselyEqual
This is an editorial change in the ECMA-262 spec.

See: da3d674
2022-05-03 22:49:31 +02:00
Linus Groh
17fb40bc42 LibJS: Fix type confusion in msFromTime
This is an editorial change in the ECMA-262 spec.

See: 8e572b6
2022-05-03 22:49:31 +02:00
Linus Groh
03e13715ac LibJS: Update two comments saying "completion value"
This is an editorial change in the ECMA-262 spec.

See: 7913cea
2022-05-03 22:49:31 +02:00
Linus Groh
99cc442f5c LibJS: Use more consistent wording for creating empty lists
This is an editorial change in the ECMA-262 spec.

See: 0bf22a9
2022-05-03 22:49:31 +02:00
Linus Groh
438e3ceb4a LibJS: Use CreateDataPropertyOrThrow in MakeMatchIndicesIndexPairArray
This was part of a normative change in the ECMA-262 spec, but didn't get
updated when we implemented that.

See: 0209d85
2022-05-03 22:49:31 +02:00
Linus Groh
9f3f3b0864 LibJS: Remove implicit wrapping/unwrapping of completion records
This is an editorial change in the ECMA-262 spec, with similar changes
in some proposals.

See:
- 7575f74
- df899eb
- 9eb5a12
- c81f527
2022-05-03 01:09:29 +02:00
Linus Groh
8cbd25f553 LibJS: Simplify Is{Accessor,Data,Generic}Descriptor AOs
This is an editorial change in the ECMA-262 spec.

See: 1c7ae4b
2022-05-01 22:47:38 +02:00
Linus Groh
07ac8b7021 LibJS: Change "Record {}" to "Iterator Record {}" in comments
This is an editorial change in the ECMA-262 spec.

See: 85d910c
2022-05-01 22:47:38 +02:00
Linus Groh
c9bdd59e20 LibJS: Change "Completion {}" to "Completion Record {}" in comments
This is an editorial change in the ECMA-262 spec.

See: 15a7d8a
2022-05-01 22:47:38 +02:00
Linus Groh
719137418d LibJS: Change "as [the] argument[s]" to "with arguments" in comments
This is an editorial change in the ECMA-262 spec.

See: e671b96
2022-05-01 22:47:38 +02:00
Linus Groh
214d5e3e83 LibJS: Update outdated table reference in BoundFunctionCreate 2022-05-01 22:47:38 +02:00
Linus Groh
7767f9be37 LibJS: Rename some variables from "script body" to "script"
This is an editorial change in the ECMA-262 spec.

See: 38a2584
2022-05-01 22:47:38 +02:00
Linus Groh
acda12597a LibJS: Rename scope to environment
This is an editorial change in the ECMA-262 spec.

See: 3246553
2022-05-01 22:47:38 +02:00
Linus Groh
cb66474fb5 LibJS: Update spec comments testing presence of a field
This is an editorial change in the ECMA-262 spec.

See:
- 497f99a
- 0b35749
2022-05-01 22:47:38 +02:00
Linus Groh
d33fcad87f LibJS: Update ValidateAndApplyPropertyDescriptor implementation
These are editorial changes in the ECMA-262 spec.

See:
- b9efa97
- 6f4ff96
- 3d18997
- b3c29fd
2022-05-01 22:47:38 +02:00
Linus Groh
85c16452f9 LibJS: Simplify Array.prototype.splice()
This is an editorial change in the ECMA-262 spec.

See: 193211a
2022-05-01 22:47:38 +02:00
Linus Groh
5a26a547db LibJS: Update a couple of outdated spec comments
These are editorial changes in the ECMA-262 spec.

See:
- e080a7f
- c5a9094
- 5091520
- 1c6564b
- e06c80c
2022-05-01 22:47:38 +02:00
Linus Groh
ce659e5eeb LibJS: Remove assertions that are now part of structured headers
This is an editorial change in the ECMA-262 spec.

See: 4fde514
2022-05-01 22:13:21 +02:00
Linus Groh
86e3840202 LibJS: Add missing comment in OrdinaryToPrimitive 2022-05-01 22:13:21 +02:00
Idan Horowitz
1a8b5ef80a LibJS: Stop fetching GlobalObject from target's realm in ArrayBuffer
A function object's realm is not necessarily non-null (like when called
via the Reflect API), so we can't blindly dereference it. Instead use
the object's own GlobalObject.
2022-04-30 21:55:39 +02:00
Idan Horowitz
9098257668 LibJS: Reject -00000 as extended year in Date parsing 2022-04-30 21:36:27 +02:00
Idan Horowitz
0399239e3f LibJS: Do not negate zero into negative zero in ToIntegerOrInfinity
When the input value was in the range of [-1, 0] we would incorrectly
negate the resulting integer, resulting in -0 instead of the expected 0
2022-04-30 21:35:16 +02:00
Idan Horowitz
7ac9900023 LibJS: Reorder parsing for TimeSpecWithOptionalTimeZoneNotAmbiguous
Because `TimeHour TimeZoneNumericUTCOffsetNotAmbiguous[opt]
TimeZoneBracketedAnnotation[opt]` can be a subset of
`TimeHourNotValidMonth TimeZone` we would not exhaust the whole input
in some cases, which would result in an incorrectly thrown exception.
2022-04-30 18:36:10 +02:00
Linus Groh
27793bf76c LibJS: Replace U+2212 MINUS SIGN with U+002D HYPHEN-MINUS
This is an editorial change in the Temporal spec.

See: bbcd37b
2022-04-29 22:40:46 +02:00
Linus Groh
df1f81ba90 LibJS: Add notes about lifetime of surrounding agent
This is an editorial change in the Temporal spec.

See: 54e4abc
2022-04-29 22:40:46 +02:00
Linus Groh
76a6bd0e75 LibJS: Fix numeric type confusion in GetEpochFromISOParts return value
This is an editorial change in the Temporal spec.

See: 2a59eac
2022-04-29 22:40:46 +02:00
Linus Groh
70593b7448 LibJS: Update for structured headers added to various Temporal AOs
This is an editorial change in the Temporal spec.

See: e6a15a5
2022-04-29 22:40:46 +02:00
Linus Groh
9a3014c91a LibJS: Drop "integral part of" language
This is an editorial change in the Temporal spec.

See: 6ec1608
2022-04-29 22:40:46 +02:00
Linus Groh
cb33320814 LibJS: Fix one more instance of Number value / integer confusion
This is an editorial change in the Temporal spec.

See: 5b1b783
2022-04-29 22:40:46 +02:00
Linus Groh
aac457755d LibJS: Define IsBuiltinCalendar in terms of AvailableCalendars
This is an editorial change in the Temporal spec.

See: 896b72d
2022-04-29 22:40:46 +02:00
Linus Groh
2499911898 LibJS: Rename DateFromFields to CalendarDateFromFields, etc
This is an editorial change in the Temporal spec.

See: fd27b54
2022-04-29 22:40:46 +02:00
Linus Groh
7bf4a785c6 LibJS: Fix RoundNumberToIncrement spec number 2022-04-29 21:52:30 +02:00
Linus Groh
bc4a0baa8f LibJS: Remove outdated FIXMEs about required date_from_fields() options
The `options` parameter is no longer required by the function, so we can
stop passing in options as well where not required by the spec.
2022-04-29 19:50:41 +02:00