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

LibWeb: Implement window.queueMicrotask(callback)

This API allows authors to schedule a serialized JS callback that will
get invoked at the next spec-allowed opportunity.
This commit is contained in:
Andreas Kling 2021-09-26 14:36:20 +02:00
parent 831fdcaabc
commit a248ec63e3
10 changed files with 144 additions and 19 deletions

View file

@ -642,6 +642,10 @@ JS::Interpreter& Document::interpreter()
auto& vm = m_interpreter->vm();
vm.run_queued_promise_jobs();
vm.run_queued_finalization_registry_cleanup_jobs();
// FIXME: This isn't exactly the right place for this.
HTML::main_thread_event_loop().perform_a_microtask_checkpoint();
// Note: This is not an exception check for the promise jobs, they will just leave any
// exception that already exists intact and never throw a new one (without cleaning it
// up, that is). Taking care of any previous unhandled exception just happens to be the