summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
AgeCommit message (Collapse)Author
2021-07-22LibJS: Transcode UTF-8 strings to UTF-16 and add UTF-16 accessorsTimothy Flynn
LibJS parses JavaScript as UTF-8, so when creating a string, we must transcode it to UTF-16 to handle encoded surrogate pairs. For example, consider the following string: "\ud83d\ude00" The UTF-8 encoding of this surrogate pair is: 0xf0 0x9f 0x98 0x80 However, LibJS will currently store the two surrogates individually as UTF-8 encoded bytes, rather than combining the pair: 0xed 0xa0 0xb8, 0xed 0xb8 0x80 These are not equivalent. So, as String.prototype becomes UTF-16 aware, this encoding will no longer work for abstractions like strict equality.
2021-07-22LibJS: Add UTF-16 tests to String.prototype methods that already workTimothy Flynn
These methods did not require UTF-16 views, so just add test cases to ensure they remain correct. This also adds a couple of FIXME comments on tests that will fail even with UTF-16 String.prototype support (for reasons such as lack of UTF-16 support in RegExp.prototype and Unicode case folding).
2021-07-21LibJS: Implement Temporal.PlainDate.prototype.equals & Required AOIdan Horowitz
2021-07-21LibJS: Implement the ToTemporalDate Abstract OperationIdan Horowitz
This is required by most Temporal.PlainDate.prototype methods.
2021-07-21LibJS: Add Temporal.Calendar.prototype.dateFromFields & required AOsIdan Horowitz
This is required for implementing the DateFromFields PlainDate AO.
2021-07-21LibJS: Use trunc instead of a static_cast<i64> in is_integral_numberIdan Horowitz
This ensures we return true for integers that do not fit in an i64 aka, above 9223372036854775807. (2**63 - 1)
2021-07-21LibJS: Remove usages of String's null state in Temporal AOsIdan Horowitz
2021-07-21LibJS: Implement Temporal.PlainDate.prototype.valueOfIdan Horowitz
2021-07-21LibJS: Use IntrusiveList for keeping track of WeakContainersAndreas Kling
2021-07-21LibJS: Use IntrusiveList for keeping track of MarkedValueListsAndreas Kling
2021-07-20LibJS: Fix that non-existent references are unresolvable in strict modedavidot
2021-07-20LibJS: Follow the spec more closely when determining the this valueTimothy Flynn
Co-authored-by: davidot <david.tuin@gmail.com>
2021-07-20LibJS: Fix that vm.in_strict_mode was propagated to eval and functionsdavidot
For eval it depends on the CallerMode and for a created function it depends on the function itself.
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19LibJS: Implement Temporal.PlainDate.prototype.calendarIdan Horowitz
2021-07-19LibJS: Implement Temporal.PlainDate.prototype[@@toStringTag]Idan Horowitz
2021-07-19LibJS: Start implementing Temporal.PlainDateIdan Horowitz
This commit adds the PlainDate object itself, its constructor and prototype (currently empty), and several required abstract operations.
2021-07-19LibJS: Rename Temporal.now => Temporal.NowLinus Groh
See: - https://github.com/tc39/proposal-temporal/commit/d0acb66 - https://github.com/tc39/proposal-temporal/commit/0097fdd
2021-07-19LibJS: Reflect recent editorial changes in the Temporal proposalLinus Groh
See: - https://github.com/tc39/proposal-temporal/commit/2148441 - https://github.com/tc39/proposal-temporal/commit/08c04cc - https://github.com/tc39/proposal-temporal/commit/b77da58
2021-07-19LibJS: Implement Temporal.Duration.from()Linus Groh
...with ParseTemporalDurationString currently TODO()'d.
2021-07-19LibJS: Fix TemporalDurationLike property orderLinus Groh
The table is sorted alphabetically and supposed to be iterated in that oder. Also move this to a templated lambda for later re-use with different target structs and value types.
2021-07-19LibJS: Move Temporal AO structs/enum classes above function declarationsLinus Groh
This is a bit closer to our usual style, and tidier.
2021-07-18LibJS: Use a Utf8View on the subject if the regex has the unicode flagAli Mohammad Pur
This makes LibRegex behave (more) correctly with regards to matching unicode code points.
2021-07-17LibJS: Report string length as the code point length, not byte lengthTimothy Flynn
For example, U+180E is 3 bytes, but should have a string length of 1.
2021-07-16LibJS: Implement Temporal.Duration.prototype.abs()Linus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.negated()Linus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.with()Linus Groh
2021-07-16LibJS: Ensure RegExpStringIterator keeps the RegExp matcher object aliveTimothy Flynn
Fixes a crash found with 'test-js -g' due to this object going out of scope.
2021-07-16LibJS: Replace the boolean argument of Object::set with an enum classIdan Horowitz
This is more serenity-esque and also makes pointing out missing exception checks during reviews much easier.
2021-07-16LibJS: Remove unused Object::PutOwnPropertyMode enum classIdan Horowitz
All usages of this enum class were removed in the Object rewrite, but this enum was left behind.
2021-07-16LibJS: Implement RegExp AdvanceStringIndex abstractionTimothy Flynn
This isn't particularly useful yet because the underlying LibRegex engine doesn't support unicode matching yet. But the debt of FIXMEs related to AdvanceStringIndex have added up, so let's get this out of the way.
2021-07-16LibJS: Implement RegExp.prototype [ @@matchAll ]Timothy Flynn
This also allows String.prototype.matchAll to work, as all calls to that method result in an invocation to @@matchAll.
2021-07-16LibJS: Implement the RegExpStringIterator objectTimothy Flynn
This implementation closely follows the StringIterator object in that the abstract closure meant to be created in CreateRegExpStringIterator is instead unrolled into RegExpStringIterator.prototype.next.
2021-07-16LibJS: Make the RegExpExec abstraction publically availableTimothy Flynn
For RegExpStringIterator, this will be needed outside of the RegExp prototype.
2021-07-16LibJS: Implement Temporal.Duration.prototype.valueOf()Linus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.blankLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.signLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.nanosecondsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.microsecondsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.millisecondsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.secondsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.minutesLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.hoursLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.daysLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.weeksLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.monthsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype.yearsLinus Groh
2021-07-16LibJS: Implement Temporal.Duration.prototype[@@toStringTag]Linus Groh
2021-07-16LibJS: Start implementing Temporal.DurationLinus Groh
This patch adds the Duration object itself, its constructor and prototype (currently empty), and three required abstract operations.
2021-07-14LibJS: Implement Temporal.Calendar.prototype.idLinus Groh