1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibWeb: Implement the JS host hooks for promises, job callbacks and more

This overrides the JS host hooks to follow the spec for queuing
promises, making/calling job callbacks, unhandled promise rejection
handling and FinalizationRegistry queuing.

This also allows us to drop the on_call_stack_emptied hook in
Document::interpreter().
This commit is contained in:
Luke Wilde 2022-02-06 03:32:26 +00:00 committed by Linus Groh
parent 4c1c6ef91c
commit 17aeb99e9e
7 changed files with 290 additions and 20 deletions

View file

@ -284,7 +284,8 @@ void EventLoop::perform_a_microtask_checkpoint()
// FIXME: 5. Cleanup Indexed Database transactions.
// FIXME: 6. Perform ClearKeptObjects().
// 6. Perform ClearKeptObjects().
vm().finish_execution_generation();
// 7. Set the event loop's performing a microtask checkpoint to false.
m_performing_a_microtask_checkpoint = false;

View file

@ -26,6 +26,7 @@ public:
PostedMessage,
Microtask,
TimerTask,
JavaScriptEngine,
};
static NonnullOwnPtr<Task> create(Source source, DOM::Document* document, Function<void()> steps)