2020-10-13 21:49:19 +00:00
|
|
|
/*
|
2024-10-04 11:19:50 +00:00
|
|
|
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
2020-10-13 21:49:19 +00:00
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-10-13 21:49:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-09 00:23:00 +00:00
|
|
|
#include <AK/DeprecatedFlyString.h>
|
2020-10-13 21:49:19 +00:00
|
|
|
#include <LibJS/Forward.h>
|
2021-10-24 14:01:24 +00:00
|
|
|
#include <LibJS/Runtime/PropertyKey.h>
|
2020-10-13 21:49:19 +00:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
#define ENUMERATE_STANDARD_PROPERTY_NAMES(P) \
|
2021-06-17 11:12:38 +00:00
|
|
|
P(__proto__) \
|
2021-06-17 11:14:09 +00:00
|
|
|
P(__defineGetter__) \
|
|
|
|
P(__defineSetter__) \
|
2021-06-17 11:15:14 +00:00
|
|
|
P(__lookupGetter__) \
|
|
|
|
P(__lookupSetter__) \
|
2022-10-17 00:59:27 +00:00
|
|
|
P($1) \
|
|
|
|
P($2) \
|
|
|
|
P($3) \
|
|
|
|
P($4) \
|
|
|
|
P($5) \
|
|
|
|
P($6) \
|
|
|
|
P($7) \
|
|
|
|
P($8) \
|
|
|
|
P($9) \
|
2021-07-11 02:53:54 +00:00
|
|
|
P(Atomics) \
|
2020-12-02 09:58:48 +00:00
|
|
|
P(BYTES_PER_ELEMENT) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(BigInt) \
|
|
|
|
P(Boolean) \
|
|
|
|
P(E) \
|
|
|
|
P(EPSILON) \
|
2021-06-27 19:48:34 +00:00
|
|
|
P(Function) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(Infinity) \
|
2021-08-08 17:27:28 +00:00
|
|
|
P(Intl) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(JSON) \
|
|
|
|
P(LN10) \
|
|
|
|
P(LN2) \
|
|
|
|
P(LOG10E) \
|
|
|
|
P(LOG2E) \
|
|
|
|
P(MAX_SAFE_INTEGER) \
|
2021-06-04 21:56:43 +00:00
|
|
|
P(MAX_VALUE) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(MIN_SAFE_INTEGER) \
|
2021-06-04 21:56:43 +00:00
|
|
|
P(MIN_VALUE) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(Math) \
|
|
|
|
P(NEGATIVE_INFINITY) \
|
|
|
|
P(NaN) \
|
2021-07-18 23:25:22 +00:00
|
|
|
P(Now) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(Number) \
|
|
|
|
P(PI) \
|
|
|
|
P(POSITIVE_INFINITY) \
|
|
|
|
P(Proxy) \
|
|
|
|
P(Reflect) \
|
|
|
|
P(RegExp) \
|
|
|
|
P(SQRT1_2) \
|
|
|
|
P(SQRT2) \
|
|
|
|
P(String) \
|
|
|
|
P(Symbol) \
|
2021-07-06 18:14:47 +00:00
|
|
|
P(Temporal) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(UTC) \
|
|
|
|
P(abs) \
|
2020-12-08 15:22:07 +00:00
|
|
|
P(acos) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(acosh) \
|
2021-06-08 21:14:08 +00:00
|
|
|
P(add) \
|
2022-12-21 10:48:14 +00:00
|
|
|
P(adopt) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(all) \
|
|
|
|
P(allSettled) \
|
2024-07-15 14:59:29 +00:00
|
|
|
P(alphabet) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(anchor) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(any) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(apply) \
|
2020-12-05 15:38:29 +00:00
|
|
|
P(arguments) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(asIntN) \
|
|
|
|
P(asUintN) \
|
2020-12-08 15:22:07 +00:00
|
|
|
P(asin) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(asinh) \
|
2021-04-18 15:08:14 +00:00
|
|
|
P(assert) \
|
2021-06-12 10:35:53 +00:00
|
|
|
P(assign) \
|
2021-03-12 17:13:12 +00:00
|
|
|
P(at) \
|
2020-12-08 08:52:33 +00:00
|
|
|
P(atan) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(atan2) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(atanh) \
|
2021-09-02 02:39:40 +00:00
|
|
|
P(baseName) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(big) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(bind) \
|
2021-07-15 23:15:56 +00:00
|
|
|
P(blank) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(blink) \
|
|
|
|
P(bold) \
|
2021-05-21 20:26:18 +00:00
|
|
|
P(buffer) \
|
2020-12-02 20:49:31 +00:00
|
|
|
P(byteLength) \
|
2021-05-21 20:45:47 +00:00
|
|
|
P(byteOffset) \
|
2021-07-18 21:29:26 +00:00
|
|
|
P(calendar) \
|
2024-10-25 10:47:08 +00:00
|
|
|
P(calendarId) \
|
2021-08-18 20:15:04 +00:00
|
|
|
P(calendarName) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(call) \
|
2021-03-14 15:41:00 +00:00
|
|
|
P(callee) \
|
2021-06-28 00:53:35 +00:00
|
|
|
P(caller) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(caseFirst) \
|
2021-06-11 19:40:08 +00:00
|
|
|
P(cause) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(cbrt) \
|
|
|
|
P(ceil) \
|
|
|
|
P(charAt) \
|
|
|
|
P(charCodeAt) \
|
2021-06-15 19:21:24 +00:00
|
|
|
P(cleanupSome) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(clear) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(clz32) \
|
2021-06-16 14:30:41 +00:00
|
|
|
P(codePointAt) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(collation) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(compactDisplay) \
|
2021-07-12 12:59:34 +00:00
|
|
|
P(compareExchange) \
|
2021-08-20 14:41:27 +00:00
|
|
|
P(compile) \
|
2024-02-12 13:51:36 +00:00
|
|
|
P(composite) \
|
|
|
|
P(computedOffset) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(concat) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(configurable) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(console) \
|
|
|
|
P(construct) \
|
|
|
|
P(constructor) \
|
2022-01-30 19:12:42 +00:00
|
|
|
P(containing) \
|
2021-07-11 18:18:48 +00:00
|
|
|
P(compare) \
|
2021-06-13 16:09:34 +00:00
|
|
|
P(copyWithin) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(cos) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(cosh) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(count) \
|
|
|
|
P(countReset) \
|
2021-04-10 16:40:12 +00:00
|
|
|
P(create) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(currency) \
|
|
|
|
P(currencyDisplay) \
|
|
|
|
P(currencySign) \
|
2021-08-30 19:44:05 +00:00
|
|
|
P(dateAdd) \
|
2021-07-21 19:17:40 +00:00
|
|
|
P(dateFromFields) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(dateStyle) \
|
2021-10-10 21:46:10 +00:00
|
|
|
P(dateUntil) \
|
2021-07-21 19:17:40 +00:00
|
|
|
P(day) \
|
2021-07-23 14:46:20 +00:00
|
|
|
P(dayOfWeek) \
|
2021-07-23 14:58:44 +00:00
|
|
|
P(dayOfYear) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(dayPeriod) \
|
2021-07-15 22:47:04 +00:00
|
|
|
P(days) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(daysDisplay) \
|
2021-07-23 15:36:34 +00:00
|
|
|
P(daysInMonth) \
|
2021-07-23 15:27:47 +00:00
|
|
|
P(daysInWeek) \
|
2021-07-23 15:46:49 +00:00
|
|
|
P(daysInYear) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(debug) \
|
2021-04-13 19:50:29 +00:00
|
|
|
P(decodeURI) \
|
|
|
|
P(decodeURIComponent) \
|
2022-12-21 10:48:14 +00:00
|
|
|
P(defer) \
|
2021-04-10 16:39:11 +00:00
|
|
|
P(defineProperties) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(defineProperty) \
|
|
|
|
P(deleteProperty) \
|
2021-06-12 14:38:34 +00:00
|
|
|
P(deref) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(description) \
|
2023-06-29 20:24:40 +00:00
|
|
|
P(detached) \
|
2022-12-01 20:33:26 +00:00
|
|
|
P(difference) \
|
2023-06-22 01:29:24 +00:00
|
|
|
P(dir) \
|
2022-07-05 23:50:24 +00:00
|
|
|
P(direction) \
|
2021-11-01 13:20:06 +00:00
|
|
|
P(disambiguation) \
|
2022-12-21 10:48:14 +00:00
|
|
|
P(disposed) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(done) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(dotAll) \
|
2023-06-25 16:20:00 +00:00
|
|
|
P(drop) \
|
2024-02-12 13:51:36 +00:00
|
|
|
P(easing) \
|
2021-04-13 19:50:29 +00:00
|
|
|
P(encodeURI) \
|
|
|
|
P(encodeURIComponent) \
|
2020-12-25 01:58:34 +00:00
|
|
|
P(endsWith) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(entries) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(enumerable) \
|
2021-07-08 21:11:51 +00:00
|
|
|
P(epochMicroseconds) \
|
2021-07-08 20:56:03 +00:00
|
|
|
P(epochMilliseconds) \
|
2021-07-08 21:20:49 +00:00
|
|
|
P(epochNanoseconds) \
|
2021-07-08 20:47:28 +00:00
|
|
|
P(epochSeconds) \
|
2021-07-11 18:23:38 +00:00
|
|
|
P(equals) \
|
2021-08-27 18:45:10 +00:00
|
|
|
P(era) \
|
2021-08-27 18:52:41 +00:00
|
|
|
P(eraYear) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(error) \
|
2021-06-11 17:06:20 +00:00
|
|
|
P(errors) \
|
2021-06-05 16:21:15 +00:00
|
|
|
P(escape) \
|
2021-03-14 15:20:01 +00:00
|
|
|
P(eval) \
|
2021-10-13 20:40:33 +00:00
|
|
|
P(evaluate) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(every) \
|
2021-07-12 12:08:13 +00:00
|
|
|
P(exchange) \
|
2020-11-22 10:48:49 +00:00
|
|
|
P(exec) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(exp) \
|
|
|
|
P(expm1) \
|
2021-08-25 02:58:45 +00:00
|
|
|
P(fallback) \
|
2021-07-21 19:20:57 +00:00
|
|
|
P(fields) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(fill) \
|
|
|
|
P(filter) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(finally) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(find) \
|
2021-08-03 12:12:47 +00:00
|
|
|
P(findLast) \
|
|
|
|
P(findLastIndex) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(findIndex) \
|
2022-07-06 12:30:53 +00:00
|
|
|
P(firstDay) \
|
2023-10-03 14:18:18 +00:00
|
|
|
P(firstDayOfWeek) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(fixed) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(flags) \
|
2021-02-16 20:16:13 +00:00
|
|
|
P(flat) \
|
2021-06-13 14:21:59 +00:00
|
|
|
P(flatMap) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(floor) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(fontcolor) \
|
|
|
|
P(fontsize) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(forEach) \
|
2021-09-06 18:37:23 +00:00
|
|
|
P(format) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(formatMatcher) \
|
2021-12-09 00:57:21 +00:00
|
|
|
P(formatRange) \
|
2021-12-09 18:35:59 +00:00
|
|
|
P(formatRangeToParts) \
|
2021-09-06 18:57:57 +00:00
|
|
|
P(formatToParts) \
|
2022-06-29 21:58:40 +00:00
|
|
|
P(fractionalDigits) \
|
2021-08-30 23:15:36 +00:00
|
|
|
P(fractionalSecondDigits) \
|
2021-04-06 20:06:11 +00:00
|
|
|
P(freeze) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(from) \
|
2023-07-15 10:37:22 +00:00
|
|
|
P(fromAsync) \
|
2024-08-31 13:05:40 +00:00
|
|
|
P(fromBase64) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(fromCharCode) \
|
2021-06-16 08:36:23 +00:00
|
|
|
P(fromCodePoint) \
|
2021-06-15 09:46:14 +00:00
|
|
|
P(fromEntries) \
|
2021-07-09 11:10:16 +00:00
|
|
|
P(fromEpochMicroseconds) \
|
2021-07-09 11:00:31 +00:00
|
|
|
P(fromEpochMilliseconds) \
|
2021-07-09 11:20:11 +00:00
|
|
|
P(fromEpochNanoseconds) \
|
2021-07-09 10:51:23 +00:00
|
|
|
P(fromEpochSeconds) \
|
2024-09-01 22:37:12 +00:00
|
|
|
P(fromHex) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(fround) \
|
2024-11-09 21:29:03 +00:00
|
|
|
P(f16round) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(gc) \
|
|
|
|
P(get) \
|
2021-06-13 22:57:15 +00:00
|
|
|
P(getBigInt64) \
|
|
|
|
P(getBigUint64) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getCalendars) \
|
2021-08-25 13:41:25 +00:00
|
|
|
P(getCanonicalLocales) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getCollations) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getDate) \
|
|
|
|
P(getDay) \
|
2024-11-09 21:29:03 +00:00
|
|
|
P(getFloat16) \
|
2021-06-13 22:57:15 +00:00
|
|
|
P(getFloat32) \
|
|
|
|
P(getFloat64) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getFullYear) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getHourCycles) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getHours) \
|
2021-11-01 13:20:06 +00:00
|
|
|
P(getInstantFor) \
|
2021-06-13 22:57:15 +00:00
|
|
|
P(getInt8) \
|
|
|
|
P(getInt16) \
|
|
|
|
P(getInt32) \
|
2021-07-23 00:04:10 +00:00
|
|
|
P(getISOFields) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getMilliseconds) \
|
|
|
|
P(getMinutes) \
|
|
|
|
P(getMonth) \
|
2021-10-30 08:26:42 +00:00
|
|
|
P(getNextTransition) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getNumberingSystems) \
|
2021-07-25 19:19:37 +00:00
|
|
|
P(getOffsetNanosecondsFor) \
|
2021-07-31 20:54:35 +00:00
|
|
|
P(getOffsetStringFor) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getOwnPropertyDescriptor) \
|
2021-07-06 16:41:54 +00:00
|
|
|
P(getOwnPropertyDescriptors) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getOwnPropertyNames) \
|
2021-06-12 14:41:13 +00:00
|
|
|
P(getOwnPropertySymbols) \
|
2021-07-31 21:21:53 +00:00
|
|
|
P(getPlainDateTimeFor) \
|
2021-10-30 08:22:19 +00:00
|
|
|
P(getPossibleInstantsFor) \
|
2021-10-30 08:28:12 +00:00
|
|
|
P(getPreviousTransition) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getPrototypeOf) \
|
|
|
|
P(getSeconds) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getTextInfo) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getTime) \
|
2021-06-06 12:53:52 +00:00
|
|
|
P(getTimezoneOffset) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getTimeZones) \
|
2021-06-13 22:57:15 +00:00
|
|
|
P(getUint8) \
|
|
|
|
P(getUint16) \
|
|
|
|
P(getUint32) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(getUTCDate) \
|
|
|
|
P(getUTCDay) \
|
|
|
|
P(getUTCFullYear) \
|
|
|
|
P(getUTCHours) \
|
|
|
|
P(getUTCMilliseconds) \
|
|
|
|
P(getUTCMinutes) \
|
|
|
|
P(getUTCMonth) \
|
|
|
|
P(getUTCSeconds) \
|
2023-11-13 15:18:25 +00:00
|
|
|
P(getWeekInfo) \
|
2021-05-29 20:52:17 +00:00
|
|
|
P(getYear) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(global) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(globalThis) \
|
2022-01-29 21:47:29 +00:00
|
|
|
P(granularity) \
|
2021-12-22 12:32:15 +00:00
|
|
|
P(group) \
|
2023-07-11 14:23:00 +00:00
|
|
|
P(groupBy) \
|
2021-12-22 12:32:15 +00:00
|
|
|
P(groupCollapsed) \
|
|
|
|
P(groupEnd) \
|
2020-11-22 10:48:49 +00:00
|
|
|
P(groups) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(has) \
|
2021-07-09 20:10:17 +00:00
|
|
|
P(hasIndices) \
|
2021-05-18 09:15:49 +00:00
|
|
|
P(hasOwn) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(hasOwnProperty) \
|
2021-07-28 17:53:05 +00:00
|
|
|
P(hour) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(hour12) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(hourCycle) \
|
2021-07-15 22:48:59 +00:00
|
|
|
P(hours) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(hoursDisplay) \
|
2021-11-03 16:21:58 +00:00
|
|
|
P(hoursInDay) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(hypot) \
|
2021-07-08 19:51:57 +00:00
|
|
|
P(id) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(ignoreCase) \
|
2022-01-29 16:31:39 +00:00
|
|
|
P(ignorePunctuation) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(imul) \
|
2021-10-15 00:10:05 +00:00
|
|
|
P(importValue) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(includes) \
|
2020-11-22 10:48:49 +00:00
|
|
|
P(index) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(indexOf) \
|
2021-07-09 23:51:56 +00:00
|
|
|
P(indices) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(info) \
|
2021-07-23 16:03:19 +00:00
|
|
|
P(inLeapYear) \
|
2020-11-22 10:48:49 +00:00
|
|
|
P(input) \
|
2021-07-07 16:42:21 +00:00
|
|
|
P(instant) \
|
2022-12-01 20:17:43 +00:00
|
|
|
P(intersection) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(is) \
|
|
|
|
P(isArray) \
|
2022-12-01 21:00:44 +00:00
|
|
|
P(isDisjointFrom) \
|
2024-11-09 16:59:08 +00:00
|
|
|
P(isError) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(isExtensible) \
|
|
|
|
P(isFinite) \
|
2021-04-06 20:45:12 +00:00
|
|
|
P(isFrozen) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(isInteger) \
|
2021-07-12 14:35:14 +00:00
|
|
|
P(isLockFree) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(isNaN) \
|
2020-12-28 01:22:38 +00:00
|
|
|
P(isPrototypeOf) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(isSafeInteger) \
|
2021-04-06 20:45:12 +00:00
|
|
|
P(isSealed) \
|
2022-12-01 20:49:50 +00:00
|
|
|
P(isSubsetOf) \
|
2022-12-01 20:54:43 +00:00
|
|
|
P(isSupersetOf) \
|
2020-12-02 20:49:31 +00:00
|
|
|
P(isView) \
|
2021-07-23 00:04:10 +00:00
|
|
|
P(isoDay) \
|
|
|
|
P(isoHour) \
|
|
|
|
P(isoMicrosecond) \
|
|
|
|
P(isoMillisecond) \
|
|
|
|
P(isoMinute) \
|
|
|
|
P(isoMonth) \
|
|
|
|
P(isoNanosecond) \
|
|
|
|
P(isoSecond) \
|
|
|
|
P(isoYear) \
|
2022-12-01 15:36:44 +00:00
|
|
|
P(isWellFormed) \
|
2022-01-30 18:50:23 +00:00
|
|
|
P(isWordLike) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(italics) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(join) \
|
|
|
|
P(keyFor) \
|
|
|
|
P(keys) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(language) \
|
2022-01-12 18:52:51 +00:00
|
|
|
P(languageDisplay) \
|
2021-09-06 18:21:57 +00:00
|
|
|
P(largestUnit) \
|
2024-08-31 13:05:40 +00:00
|
|
|
P(lastChunkHandling) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(lastIndex) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(lastIndexOf) \
|
|
|
|
P(length) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(link) \
|
2021-07-11 15:45:21 +00:00
|
|
|
P(load) \
|
2021-08-25 03:26:44 +00:00
|
|
|
P(locale) \
|
2021-07-25 22:23:39 +00:00
|
|
|
P(localeCompare) \
|
2021-08-25 02:58:45 +00:00
|
|
|
P(localeMatcher) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(log) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(log1p) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(log2) \
|
|
|
|
P(log10) \
|
2022-10-17 00:59:27 +00:00
|
|
|
P(lastMatch) \
|
|
|
|
P(lastParen) \
|
|
|
|
P(leftContext) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(map) \
|
|
|
|
P(max) \
|
2023-10-14 23:10:55 +00:00
|
|
|
P(maxByteLength) \
|
2021-09-02 23:03:41 +00:00
|
|
|
P(maximize) \
|
2021-08-16 21:23:52 +00:00
|
|
|
P(mergeFields) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(message) \
|
2021-07-28 18:05:30 +00:00
|
|
|
P(microsecond) \
|
2021-07-15 22:57:07 +00:00
|
|
|
P(microseconds) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(microsecondsDisplay) \
|
2021-07-28 18:02:44 +00:00
|
|
|
P(millisecond) \
|
2021-07-15 22:54:58 +00:00
|
|
|
P(milliseconds) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(millisecondsDisplay) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(min) \
|
2022-07-06 12:30:53 +00:00
|
|
|
P(minimalDays) \
|
2021-09-03 01:45:42 +00:00
|
|
|
P(minimize) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(maximumFractionDigits) \
|
|
|
|
P(maximumSignificantDigits) \
|
|
|
|
P(minimumFractionDigits) \
|
|
|
|
P(minimumIntegerDigits) \
|
|
|
|
P(minimumSignificantDigits) \
|
2021-07-28 17:55:29 +00:00
|
|
|
P(minute) \
|
2021-07-15 22:51:02 +00:00
|
|
|
P(minutes) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(minutesDisplay) \
|
2021-07-21 19:17:40 +00:00
|
|
|
P(month) \
|
|
|
|
P(monthCode) \
|
2021-08-16 17:04:58 +00:00
|
|
|
P(monthDayFromFields) \
|
2021-07-15 22:41:55 +00:00
|
|
|
P(months) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(monthsDisplay) \
|
2021-07-23 15:52:55 +00:00
|
|
|
P(monthsInYear) \
|
2022-12-21 10:48:14 +00:00
|
|
|
P(move) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(multiline) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(name) \
|
2021-07-28 18:07:29 +00:00
|
|
|
P(nanosecond) \
|
2021-07-15 23:07:49 +00:00
|
|
|
P(nanoseconds) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(nanosecondsDisplay) \
|
2021-07-16 18:41:37 +00:00
|
|
|
P(negated) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(next) \
|
2022-06-01 23:37:15 +00:00
|
|
|
P(normalize) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(notation) \
|
2023-11-15 21:19:15 +00:00
|
|
|
P(notify) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(now) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(numberingSystem) \
|
|
|
|
P(numeric) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(of) \
|
2021-08-04 22:18:19 +00:00
|
|
|
P(offset) \
|
2021-08-04 22:17:07 +00:00
|
|
|
P(offsetNanoseconds) \
|
2024-07-15 14:59:29 +00:00
|
|
|
P(omitPadding) \
|
2021-08-18 19:27:44 +00:00
|
|
|
P(overflow) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(ownKeys) \
|
|
|
|
P(padEnd) \
|
|
|
|
P(padStart) \
|
|
|
|
P(parse) \
|
|
|
|
P(parseFloat) \
|
2020-12-05 12:51:09 +00:00
|
|
|
P(parseInt) \
|
2024-11-01 23:09:07 +00:00
|
|
|
P(pause) \
|
2021-07-26 23:21:16 +00:00
|
|
|
P(plainDate) \
|
2021-07-26 23:30:10 +00:00
|
|
|
P(plainDateISO) \
|
2021-07-26 23:49:52 +00:00
|
|
|
P(plainDateTime) \
|
2021-07-26 23:58:57 +00:00
|
|
|
P(plainDateTimeISO) \
|
2021-11-02 16:47:23 +00:00
|
|
|
P(plainTime) \
|
2021-07-28 18:29:16 +00:00
|
|
|
P(plainTimeISO) \
|
2022-01-28 18:42:20 +00:00
|
|
|
P(pluralCategories) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(pop) \
|
|
|
|
P(pow) \
|
|
|
|
P(preventExtensions) \
|
2023-07-12 19:28:03 +00:00
|
|
|
P(promise) \
|
2020-12-24 17:51:28 +00:00
|
|
|
P(propertyIsEnumerable) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(prototype) \
|
2021-06-08 20:48:43 +00:00
|
|
|
P(proxy) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(push) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(race) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(random) \
|
|
|
|
P(raw) \
|
2024-08-31 14:24:01 +00:00
|
|
|
P(read) \
|
2021-08-21 21:00:48 +00:00
|
|
|
P(reason) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(reduce) \
|
|
|
|
P(reduceRight) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(region) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(reject) \
|
2021-11-09 17:19:28 +00:00
|
|
|
P(relativeTo) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(repeat) \
|
2023-10-14 23:10:55 +00:00
|
|
|
P(resizable) \
|
|
|
|
P(resize) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(resolve) \
|
2021-08-25 03:26:44 +00:00
|
|
|
P(resolvedOptions) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(reverse) \
|
2021-06-08 20:48:43 +00:00
|
|
|
P(revocable) \
|
|
|
|
P(revoke) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(round) \
|
2021-08-18 19:27:44 +00:00
|
|
|
P(roundingIncrement) \
|
|
|
|
P(roundingMode) \
|
2022-07-12 17:18:23 +00:00
|
|
|
P(roundingPriority) \
|
2022-10-17 00:59:27 +00:00
|
|
|
P(rightContext) \
|
2021-09-02 02:08:15 +00:00
|
|
|
P(script) \
|
2021-04-06 20:06:11 +00:00
|
|
|
P(seal) \
|
2021-07-28 17:59:27 +00:00
|
|
|
P(second) \
|
2021-07-15 22:53:19 +00:00
|
|
|
P(seconds) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(secondsDisplay) \
|
2022-01-29 23:31:59 +00:00
|
|
|
P(segment) \
|
2022-07-07 14:01:00 +00:00
|
|
|
P(select) \
|
2022-07-11 15:28:10 +00:00
|
|
|
P(selectRange) \
|
2022-01-29 16:31:39 +00:00
|
|
|
P(sensitivity) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(set) \
|
2021-06-13 23:02:53 +00:00
|
|
|
P(setBigInt64) \
|
|
|
|
P(setBigUint64) \
|
2021-06-06 13:25:33 +00:00
|
|
|
P(setDate) \
|
2024-11-09 21:29:03 +00:00
|
|
|
P(setFloat16) \
|
2021-06-13 23:02:53 +00:00
|
|
|
P(setFloat32) \
|
|
|
|
P(setFloat64) \
|
2024-08-31 14:24:01 +00:00
|
|
|
P(setFromBase64) \
|
2024-09-01 22:44:39 +00:00
|
|
|
P(setFromHex) \
|
2021-03-14 15:23:46 +00:00
|
|
|
P(setFullYear) \
|
2021-03-19 19:12:08 +00:00
|
|
|
P(setHours) \
|
2021-06-13 23:02:53 +00:00
|
|
|
P(setInt8) \
|
|
|
|
P(setInt16) \
|
|
|
|
P(setInt32) \
|
2021-03-19 19:12:08 +00:00
|
|
|
P(setMilliseconds) \
|
|
|
|
P(setMinutes) \
|
2021-06-06 13:26:29 +00:00
|
|
|
P(setMonth) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(setPrototypeOf) \
|
2021-03-19 19:12:08 +00:00
|
|
|
P(setSeconds) \
|
2021-06-06 13:27:21 +00:00
|
|
|
P(setTime) \
|
2021-06-13 23:02:53 +00:00
|
|
|
P(setUint8) \
|
|
|
|
P(setUint16) \
|
|
|
|
P(setUint32) \
|
2021-06-06 14:34:04 +00:00
|
|
|
P(setUTCDate) \
|
|
|
|
P(setUTCFullYear) \
|
|
|
|
P(setUTCHours) \
|
|
|
|
P(setUTCMilliseconds) \
|
|
|
|
P(setUTCMinutes) \
|
|
|
|
P(setUTCMonth) \
|
|
|
|
P(setUTCSeconds) \
|
2021-05-29 20:52:17 +00:00
|
|
|
P(setYear) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(shift) \
|
|
|
|
P(sign) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(signDisplay) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(sin) \
|
2021-09-06 18:36:54 +00:00
|
|
|
P(since) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(sinh) \
|
2021-06-08 21:08:47 +00:00
|
|
|
P(size) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(slice) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(small) \
|
2021-08-18 19:27:44 +00:00
|
|
|
P(smallestUnit) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(some) \
|
2020-12-26 11:14:14 +00:00
|
|
|
P(sort) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(source) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(splice) \
|
|
|
|
P(sqrt) \
|
2022-02-06 16:00:28 +00:00
|
|
|
P(stack) \
|
2021-11-03 20:22:55 +00:00
|
|
|
P(startOfDay) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(startsWith) \
|
2021-08-21 21:00:48 +00:00
|
|
|
P(status) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(sticky) \
|
2021-07-11 18:37:54 +00:00
|
|
|
P(store) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(strike) \
|
2020-11-29 19:28:10 +00:00
|
|
|
P(stringify) \
|
2021-08-25 02:58:45 +00:00
|
|
|
P(style) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(sub) \
|
2021-07-09 14:17:10 +00:00
|
|
|
P(subarray) \
|
2020-11-29 19:28:10 +00:00
|
|
|
P(substr) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(substring) \
|
2021-08-06 23:38:21 +00:00
|
|
|
P(subtract) \
|
LibJS: Add String.prototype.anchor & friends
Adds an implementation of the following StringPrototype methods:
anchor, big, blink, bold, fixed, fontcolor, fontsize, italics, link,
small, strike, sub, sup.
2021-05-29 22:44:18 +00:00
|
|
|
P(sup) \
|
2022-12-06 01:10:01 +00:00
|
|
|
P(suppressed) \
|
2021-09-04 16:08:57 +00:00
|
|
|
P(supportedLocalesOf) \
|
2022-01-30 22:36:23 +00:00
|
|
|
P(supportedValuesOf) \
|
2022-12-01 20:44:04 +00:00
|
|
|
P(symmetricDifference) \
|
2024-08-09 21:24:26 +00:00
|
|
|
P(table) \
|
2023-06-25 15:45:52 +00:00
|
|
|
P(take) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(tan) \
|
2020-12-28 14:34:51 +00:00
|
|
|
P(tanh) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(test) \
|
LibJS: Add initial support for Promises
Almost a year after first working on this, it's finally done: an
implementation of Promises for LibJS! :^)
The core functionality is working and closely following the spec [1].
I mostly took the pseudo code and transformed it into C++ - if you read
and understand it, you will know how the spec implements Promises; and
if you read the spec first, the code will look very familiar.
Implemented functions are:
- Promise() constructor
- Promise.prototype.then()
- Promise.prototype.catch()
- Promise.prototype.finally()
- Promise.resolve()
- Promise.reject()
For the tests I added a new function to test-js's global object,
runQueuedPromiseJobs(), which calls vm.run_queued_promise_jobs().
By design, queued jobs normally only run after the script was fully
executed, making it improssible to test handlers in individual test()
calls by default [2].
Subsequent commits include integrations into LibWeb and js(1) -
pretty-printing, running queued promise jobs when necessary.
This has an unusual amount of dbgln() statements, all hidden behind the
PROMISE_DEBUG flag - I'm leaving them in for now as they've been very
useful while debugging this, things can get quite complex with so many
asynchronously executed functions.
I've not extensively explored use of these APIs for promise-based
functionality in LibWeb (fetch(), Notification.requestPermission()
etc.), but we'll get there in due time.
[1]: https://tc39.es/ecma262/#sec-promise-objects
[2]: https://tc39.es/ecma262/#sec-jobs-and-job-queues
2021-04-01 20:13:29 +00:00
|
|
|
P(then) \
|
2021-12-22 16:40:57 +00:00
|
|
|
P(time) \
|
|
|
|
P(timeEnd) \
|
|
|
|
P(timeLog) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(timeStyle) \
|
2021-07-06 22:54:53 +00:00
|
|
|
P(timeZone) \
|
2021-11-10 00:14:16 +00:00
|
|
|
P(timeZoneName) \
|
2023-06-25 17:49:46 +00:00
|
|
|
P(toArray) \
|
2024-07-15 14:59:29 +00:00
|
|
|
P(toBase64) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toDateString) \
|
2022-01-04 00:48:44 +00:00
|
|
|
P(toExponential) \
|
2021-06-19 14:02:42 +00:00
|
|
|
P(toFixed) \
|
2021-03-14 15:40:41 +00:00
|
|
|
P(toGMTString) \
|
2024-07-15 16:30:26 +00:00
|
|
|
P(toHex) \
|
2021-08-05 20:48:23 +00:00
|
|
|
P(toInstant) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toISOString) \
|
|
|
|
P(toJSON) \
|
|
|
|
P(toLocaleDateString) \
|
2021-07-27 20:35:25 +00:00
|
|
|
P(toLocaleLowerCase) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toLocaleString) \
|
|
|
|
P(toLocaleTimeString) \
|
2021-07-27 20:35:25 +00:00
|
|
|
P(toLocaleUpperCase) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toLowerCase) \
|
2021-07-22 23:39:18 +00:00
|
|
|
P(toPlainDate) \
|
2021-07-29 21:28:04 +00:00
|
|
|
P(toPlainDateTime) \
|
2021-08-16 17:13:47 +00:00
|
|
|
P(toPlainMonthDay) \
|
2021-07-30 22:44:31 +00:00
|
|
|
P(toPlainTime) \
|
2021-08-15 23:42:01 +00:00
|
|
|
P(toPlainYearMonth) \
|
2022-01-03 04:06:51 +00:00
|
|
|
P(toPrecision) \
|
2022-06-13 06:57:38 +00:00
|
|
|
P(toReversed) \
|
2022-06-13 06:59:19 +00:00
|
|
|
P(toSorted) \
|
2022-06-13 07:00:29 +00:00
|
|
|
P(toSpliced) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toString) \
|
2021-11-13 17:38:00 +00:00
|
|
|
P(total) \
|
2021-07-07 23:31:49 +00:00
|
|
|
P(toTemporalInstant) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(toTimeString) \
|
|
|
|
P(toUpperCase) \
|
2021-03-16 13:36:32 +00:00
|
|
|
P(toUTCString) \
|
2022-12-01 15:52:10 +00:00
|
|
|
P(toWellFormed) \
|
2021-09-08 23:27:19 +00:00
|
|
|
P(toZonedDateTime) \
|
2021-09-08 23:35:24 +00:00
|
|
|
P(toZonedDateTimeISO) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(trace) \
|
2022-07-12 17:18:23 +00:00
|
|
|
P(trailingZeroDisplay) \
|
2023-06-30 17:00:56 +00:00
|
|
|
P(transfer) \
|
|
|
|
P(transferToFixedLength) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(trim) \
|
|
|
|
P(trimEnd) \
|
2021-06-01 21:59:15 +00:00
|
|
|
P(trimLeft) \
|
|
|
|
P(trimRight) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(trimStart) \
|
|
|
|
P(trunc) \
|
2021-08-25 02:58:45 +00:00
|
|
|
P(type) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(undefined) \
|
2021-06-05 16:21:15 +00:00
|
|
|
P(unescape) \
|
2020-11-18 22:20:00 +00:00
|
|
|
P(unicode) \
|
2022-07-16 05:44:03 +00:00
|
|
|
P(unicodeSets) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(unit) \
|
|
|
|
P(unitDisplay) \
|
2021-06-15 19:21:24 +00:00
|
|
|
P(unregister) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(unshift) \
|
2022-07-16 05:44:03 +00:00
|
|
|
P(until) \
|
2022-01-29 16:31:39 +00:00
|
|
|
P(usage) \
|
2022-12-21 10:48:14 +00:00
|
|
|
P(use) \
|
2021-09-10 15:04:54 +00:00
|
|
|
P(useGrouping) \
|
2020-10-13 21:49:19 +00:00
|
|
|
P(value) \
|
|
|
|
P(valueOf) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(values) \
|
2023-11-15 21:03:27 +00:00
|
|
|
P(wait) \
|
|
|
|
P(waitAsync) \
|
2020-10-13 22:03:58 +00:00
|
|
|
P(warn) \
|
2021-07-23 15:19:45 +00:00
|
|
|
P(weekOfYear) \
|
2021-11-28 22:55:47 +00:00
|
|
|
P(weekday) \
|
2022-07-06 12:30:53 +00:00
|
|
|
P(weekend) \
|
2021-07-15 22:43:55 +00:00
|
|
|
P(weeks) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(weeksDisplay) \
|
2021-07-16 18:30:52 +00:00
|
|
|
P(with) \
|
2021-07-23 12:01:40 +00:00
|
|
|
P(withCalendar) \
|
2021-07-30 22:39:36 +00:00
|
|
|
P(withPlainDate) \
|
2021-08-27 16:05:16 +00:00
|
|
|
P(withPlainTime) \
|
2023-07-12 19:28:03 +00:00
|
|
|
P(withResolvers) \
|
2021-11-05 01:35:23 +00:00
|
|
|
P(withTimeZone) \
|
2021-07-15 22:34:53 +00:00
|
|
|
P(writable) \
|
2024-08-31 14:24:01 +00:00
|
|
|
P(written) \
|
2021-07-21 19:17:40 +00:00
|
|
|
P(year) \
|
2021-08-15 23:35:05 +00:00
|
|
|
P(yearMonthFromFields) \
|
2022-12-26 00:58:43 +00:00
|
|
|
P(yearOfWeek) \
|
2021-08-01 17:31:56 +00:00
|
|
|
P(years) \
|
2022-06-29 22:52:52 +00:00
|
|
|
P(yearsDisplay) \
|
2021-08-01 17:36:15 +00:00
|
|
|
P(zonedDateTime) \
|
|
|
|
P(zonedDateTimeISO)
|
2020-10-13 21:49:19 +00:00
|
|
|
|
|
|
|
struct CommonPropertyNames {
|
2021-10-24 14:01:24 +00:00
|
|
|
PropertyKey and_ { "and", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey catch_ { "catch", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey delete_ { "delete", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey for_ { "for", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey or_ { "or", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey register_ { "register", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey return_ { "return", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey throw_ { "throw", PropertyKey::StringMayBeNumber::No };
|
2024-04-09 06:02:15 +00:00
|
|
|
PropertyKey try_ { "try", PropertyKey::StringMayBeNumber::No };
|
2022-12-01 21:04:30 +00:00
|
|
|
PropertyKey union_ { "union", PropertyKey::StringMayBeNumber::No };
|
2021-10-24 14:01:24 +00:00
|
|
|
PropertyKey xor_ { "xor", PropertyKey::StringMayBeNumber::No };
|
2022-10-17 00:59:27 +00:00
|
|
|
PropertyKey inputAlias { "$_", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey lastMatchAlias { "$&", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey lastParenAlias { "$+", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey leftContextAlias { "$`", PropertyKey::StringMayBeNumber::No };
|
|
|
|
PropertyKey rightContextAlias { "$'", PropertyKey::StringMayBeNumber::No };
|
2021-10-24 14:01:24 +00:00
|
|
|
#define __ENUMERATE(x) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
|
2020-10-13 21:49:19 +00:00
|
|
|
ENUMERATE_STANDARD_PROPERTY_NAMES(__ENUMERATE)
|
|
|
|
#undef __ENUMERATE
|
2021-10-24 14:01:24 +00:00
|
|
|
#define __JS_ENUMERATE(x, a, b, c, t) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
|
2020-10-13 21:49:19 +00:00
|
|
|
JS_ENUMERATE_BUILTIN_TYPES
|
|
|
|
#undef __JS_ENUMERATE
|
2021-10-24 14:01:24 +00:00
|
|
|
#define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
|
2021-08-08 17:35:29 +00:00
|
|
|
JS_ENUMERATE_INTL_OBJECTS
|
|
|
|
#undef __JS_ENUMERATE
|
2021-10-24 14:01:24 +00:00
|
|
|
#define __JS_ENUMERATE(x, a, b, c) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
|
2021-07-06 19:39:55 +00:00
|
|
|
JS_ENUMERATE_TEMPORAL_OBJECTS
|
|
|
|
#undef __JS_ENUMERATE
|
2021-10-24 14:01:24 +00:00
|
|
|
#define __JS_ENUMERATE(x, a) PropertyKey x { #x, PropertyKey::StringMayBeNumber::No };
|
2020-10-13 21:49:19 +00:00
|
|
|
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
|
|
|
|
#undef __JS_ENUMERATE
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|