Commit graph

993 commits

Author SHA1 Message Date
Timothy Flynn
30a143c79e LibJS: Explicitly handle invalid Date objects in UTC time setters
This is a normative change in the ECMA-262 spec:
ca53334

Note that this also fixes a few errors where we errantly converted the
stored time value to local time.
2022-02-04 13:47:50 +00:00
Timothy Flynn
fd7d0a31d9 LibJS: Explicitly handle invalid Date objects in local time setters
This is a normative change in the ECMA-262 spec:
ca53334
2022-02-04 13:47:50 +00:00
Linus Groh
19a2b32065 LibJS: Reject '-000000' as extended year
This is a normative change in the Temporal spec.

See: e60ef9e
2022-02-02 14:46:52 +00:00
Idan Horowitz
2cd3d4a287 LibJS: Implement Intl %SegmentIteratorPrototype%.next ( ) 2022-01-31 21:05:04 +02:00
Idan Horowitz
366468f1de LibJS: Implement Intl %SegmentsPrototype%.containing 2022-01-31 21:05:04 +02:00
Timothy Flynn
02b7bf34c9 LibJS: Implement BigInt IsLessThan according to the spec 2022-01-31 17:50:54 +00:00
Timothy Flynn
9ad3debf35 LibJS: Implement BigInt loose-equality according to the spec 2022-01-31 17:50:54 +00:00
Timothy Flynn
281b0411f2 LibJS: Implement conversion of strings to BigInts according to the spec
The spec defines a StringToBigInt AO which allows for converting binary,
octal, decimal, and hexadecimal strings to a BigInt. Our conversion was
only allowing for decimal strings.
2022-01-31 17:50:54 +00:00
Timothy Flynn
fb08a5a896 LibJS: Implement Intl.supportedValuesOf
This is a stage 3 ECMA-402 proposal:
https://tc39.es/proposal-intl-enumeration/
2022-01-31 00:32:41 +00:00
Timothy Flynn
687276fc38 LibJS: Implement ECMA-402 BigInt.prototype.toLocaleString 2022-01-30 20:05:27 +00:00
Timothy Flynn
d6e926e5b1 LibJS: Support BigInt number formatting with Intl.NumberFormat 2022-01-30 20:05:27 +00:00
Idan Horowitz
4ba4e4c777 LibJS: Implement Intl %SegmentsPrototype%[@@iterator] 2022-01-30 19:47:01 +00:00
Idan Horowitz
9001a8cbe1 LibJS: Implement Intl.Segmenter.prototype.segment 2022-01-30 19:47:01 +00:00
Idan Horowitz
891dfd9cbb LibJS: Implement Intl.Segmenter.prototype.resolvedOptions 2022-01-30 19:47:01 +00:00
Idan Horowitz
6b8dfefc20 LibJS: Implement Intl.Segmenter.supportedLocalesOf 2022-01-30 19:47:01 +00:00
Idan Horowitz
a3bc06bb23 LibJS: Start implementing Intl.Segmenter 2022-01-30 19:47:01 +00:00
Timothy Flynn
4a99170cd2 LibJS: Implement Intl.Collator.prototype.resolvedOptions 2022-01-29 20:27:24 +00:00
Timothy Flynn
17306078b5 LibJS: Implement Intl.Collator.supportedLocalesOf 2022-01-29 20:27:24 +00:00
Timothy Flynn
06a6100b12 LibJS: Implement the Intl.Collator constructor 2022-01-29 20:27:24 +00:00
Timothy Flynn
4a3e142d55 LibJS: Implement a nearly empty Intl.Collator object
This adds plumbing for the Intl.Collator object, constructor, and
prototype.
2022-01-29 20:27:24 +00:00
Timothy Flynn
74939eb943 LibJS: Implement Intl.PluralRules.prototype.resolvedOptions 2022-01-28 19:38:47 +00:00
Timothy Flynn
8b3f49ff84 LibJS: Implement Intl.PluralRules.supportedLocalesOf 2022-01-28 19:38:47 +00:00
Timothy Flynn
348059bffd LibJS: Implement the Intl.PluralRules constructor 2022-01-28 19:38:47 +00:00
Timothy Flynn
0087804d10 LibJS: Implement a nearly empty Intl.PluralRules object
This adds plumbing for the Intl.PluralRules object, constructor, and
prototype.
2022-01-28 19:38:47 +00:00
Timothy Flynn
a2e791277e LibJS: Implement Intl.RelativeTimeFormat.prototype.formatToParts 2022-01-27 21:16:44 +00:00
Timothy Flynn
9c5d7e515c LibJS: Implement Intl.RelativeTimeFormat.prototype.format 2022-01-27 21:16:44 +00:00
Timothy Flynn
cf92bc42a2 LibJS: Respect per-locale minimum grouping digits when number formatting 2022-01-27 20:30:52 +00:00
Timothy Flynn
0c630d5687 LibJS: Implement Intl.RelativeTimeFormat.prototype.resolvedOptions 2022-01-25 19:02:59 +00:00
Timothy Flynn
b50880f28c LibJS: Fix errors in Intl.DateTimeFormat.prototype.resolvedOptions tests
Noticed these while implementing this prototype for RelativeTimeFormat.
2022-01-25 19:02:59 +00:00
Timothy Flynn
cf166c1d93 LibJS: Implement Intl.RelativeTimeFormat.supportedLocalesOf 2022-01-25 19:02:59 +00:00
Timothy Flynn
a2e31ed736 LibJS: Implement the Intl.RelativeTimeFormat constructor 2022-01-25 19:02:59 +00:00
Timothy Flynn
79fdec85de LibJS: Implement a nearly empty Intl.RelativeTimeFormat object
This adds plumbing for the Intl.RelativeTimeFormat object, constructor,
and prototype.
2022-01-25 19:02:59 +00:00
Linus Groh
140f1d9e55 LibJS/Tests: Enable Number.isInteger() test that now passes 2022-01-24 20:39:01 +00:00
Linus Groh
e20efaa083 LibJS: Let WrappedFunction inherit target name and length
This is a normative change in the ShadowRealm spec.

See: b73a1dc
2022-01-24 20:17:07 +00:00
davidot
986ad3ccf0 LibJS: Use HostImportModuleDynamically in ShadowRealmImportValue
Now that module loading is implemented this just works :^).

Since ShadowRealm explicitly passed a null ScriptOrModule we attempt to
get the top most ScriptOrModule in HostImportModuleDynamically.
This won't work in general as the web specifies other behavior but for
LibJS there must always be an active script to call
HostImportModuleDynamically.
2022-01-22 01:21:18 +00:00
Timothy Flynn
9cd93944b8 LibJS: Change test conditions to pass in all time zones
Mostly slapping "timeZone: UTC" on DateTimeFormat tests (we have other
tests for specific time zones). Also pick dates that are not on DST
boundaries in some time zones where that matters.
2022-01-21 19:14:38 +00:00
ForLoveOfCats
71ab8fb757 LibJS: Add in-tree test for Json parsing of negative zeros
This mirrors the cases in `built-ins/JSON/parse/text-negative-zero` in
test262
2022-01-19 21:51:09 +00:00
Timothy Flynn
42c9c57141 LibJS+LibTimeZone: Begin handling DST when computing time zone offsets
This also updates some expectations in a Temporal time zone offset test
that is using a time stamp which is in DST for a few time zones.
2022-01-19 21:20:41 +00:00
Linus Groh
7d521b7c7c LibJS: Implement Function.prototype.toString() according to the spec
That's an old yak :^)
No, past me, AST nodes do not need to learn to stringify themselves.
This is now massively simplified by using the [[SourceText]] internal
slot.

Also updates a bunch of tests that are incorrect due to the old
implementation not being spec compliant, and add plenty more.
2022-01-19 20:33:08 +00:00
Nico Weber
e09f74903e LibCrypo: Simplify mixed-sign bitwise_or
No behavior change.
2022-01-18 20:04:06 +03:30
Nico Weber
013799a4dd LibCrypto+LibJS: Better bigint bitwise_or binop
Similar to the bitwise_and change, but we have to be careful to
sign-extend two's complement numbers only up to the highest set bit
in the positive number.
2022-01-18 20:04:06 +03:30
Nico Weber
1f98639396 LibCrypto+LibJS: Better bigint bitwise_and binop
Bitwise and is defined in terms of two's complement, so some converting
needs to happen for SignedBigInteger's sign/magnitude representation to
work out.

UnsignedBigInteger::bitwise_not() is repurposed to convert all
high-order zero bits to ones up to a limit, for the two's complement
conversion to work.

Fixes test262/test/language/expressions/bitwise-and/bigint.js.
2022-01-18 20:04:06 +03:30
Nico Weber
945d962322 LibJS+LibCrypto: Fix SignedBitInteger::bitwise_not and use it in LibJS
Bitwise operators are defined on two's complement, but SignedBitInteger
uses sign-magnitude. Correctly convert between the two.

Let LibJS delegate to SignedBitInteger for bitwise_not, like it does
for all other bitwise_ operations on bigints.

No behavior change (LibJS is now the only client of
SignedBitInteger::bitwise_not()).
2022-01-18 20:04:06 +03:30
Timothy Flynn
c74f75b910 LibJS: Implement Date.prototype.setUTCDate 2022-01-16 11:07:02 +01:00
Timothy Flynn
0d73da0328 LibJS: Implement Date.prototype.setUTCFullYear 2022-01-16 11:07:02 +01:00
Timothy Flynn
51bc973ecc LibJS: Implement Date.prototype.setUTCHours 2022-01-16 11:07:02 +01:00
Timothy Flynn
6998c0a796 LibJS: Implement Date.prototype.setUTCMilliseconds 2022-01-16 11:07:02 +01:00
Timothy Flynn
2f202e8ef4 LibJS: Implement Date.prototype.setUTCMinutes 2022-01-16 11:07:02 +01:00
Timothy Flynn
f2ffe3bf90 LibJS: Implement Date.prototype.setUTCMonth 2022-01-16 11:07:02 +01:00
Timothy Flynn
c71877b0a6 LibJS: Implement Date.prototype.setUTCSeconds 2022-01-16 11:07:02 +01:00