ladybird/Meta
Linus Groh f418115f1b 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-02 10:47:40 +02:00
..
CMake LibJS: Add initial support for Promises 2021-04-02 10:47:40 +02:00
Lagom Lagom/Fuzzers: Add fuzzer for zip file parser 2021-03-27 16:28:34 +01:00
Websites/serenityos.org Website: Add link to @ABigPickle's VLA exploit 2021-03-08 22:53:28 +01:00
bochsrc Meta: move Kernel/.bochsrc => Meta/bochsrc 2020-07-01 12:53:39 +02:00
build-image-grub.sh Meta: Allow specifying custom grub config file for build-image-grub.sh 2021-03-01 11:11:56 +01:00
build-image-qemu.sh Build: Sprinkle some portability, fix on OpenBSD 2021-02-14 09:29:22 +01:00
build-root-filesystem.sh Utilities: Add simple traceroute utility 2021-03-31 23:42:24 +02:00
check-ak-test-files.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
check-debug-flags.sh Meta: Fix debug-flag detection 2021-02-13 19:50:31 +01:00
check-newlines-at-eof.py Meta: check-newlines-at-eof.py now checks .json files and files in Base/ 2021-03-08 09:20:53 +01:00
check-style.sh Meta: Stop excluding getopt.cpp from linting 2021-03-03 23:42:32 +01:00
check-symbols.sh CI: Don't fail check-symbols if symbol is defiend somewhere else 2021-03-19 22:55:53 +01:00
check-syscall-lists.sh Meta: Check consistency of various syscall tables 2021-01-23 16:47:09 +01:00
debug-kernel.sh Meta: Add a build helper script 2021-03-09 07:28:59 +01:00
generate-embedded-resource-assembly.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
grub-ebr.cfg Kernel: Introduce a new partitioning subsystem 2020-12-27 23:07:44 +01:00
grub-gpt.cfg Kernel: Stop bootloader from setting video mode with Multiboot 2020-05-28 00:50:55 +02:00
grub-mbr.cfg Kernel: Stop bootloader from setting video mode with Multiboot 2020-05-28 00:50:55 +02:00
lint-ci.sh Meta: Lint AvailablePorts.md 2021-02-15 07:41:16 +01:00
lint-clang-format.sh Meta: Stop excluding getopt.cpp from linting 2021-03-03 23:42:32 +01:00
lint-executable-resources.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
lint-ipc-ids.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
lint-keymaps.py Meta: Remove now-obsolete import from lint script 2021-02-01 22:58:56 +01:00
lint-missing-resources.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
lint-ports.py Meta: Add Ports/build_installed.sh to the lint-ports ignore list 2021-02-15 07:51:40 +01:00
lint-prettier.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
lint-python.sh Meta: Get building on NixOS (#5005) 2021-01-22 17:44:05 +01:00
lint-shell-scripts.sh Base/CI: Boot serenity in CI in a mode that runs tests on target 2021-02-28 18:19:37 +01:00
notify_irc.py Meta: Reduce IRC spam 2020-11-25 20:50:22 +01:00
refresh-serenity-qtcreator.sh Meta: Make CMakeLists accessible to QtCreator 2021-02-21 22:34:09 +01:00
run.sh Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
screenshot-000ccc0.png
screenshot-8ea4375.png Meta: Time for a new screenshot! :^) 2020-06-02 19:29:31 +02:00
screenshot-1133aca.png Meta: Time for a new screenshot (Quake edition) :^) 2019-11-06 21:51:33 +01:00
screenshot-9145a72.png Meta: Time for a new screnshot! :^) 2019-09-18 12:15:02 +02:00
screenshot-23263aa.png
screenshot-191112e.png Meta: Time for a new screenshot to keep things fresh. :^) 2019-06-07 18:14:13 +02:00
screenshot-b5521e1.png
screenshot-cdb82f6.png Meta: Tweak ReadMe and add a new screenshot. 2019-03-20 15:52:37 +01:00
screenshot-d727005.png Meta: Tweak ReadMe and add a new screenshot. 2019-04-30 15:27:35 +02:00
screenshot-ef9fbef.png Meta: Time for a new screenshot :^) 2019-04-06 01:31:12 +02:00
screenshot-f8fc892.png
serenity.sh Meta: Pass arguments to 'serenity.sh run lagom' executable 2021-03-24 20:38:05 +01:00
text-to-cpp-string.sh Meta: Use a bash shebang for text-to-cpp-string.sh 2021-01-22 18:41:08 +01:00
write-only-on-difference.sh Build: Sprinkle some portability, fix on OpenBSD 2021-02-14 09:29:22 +01:00