LibWeb/FileAPI: Use HTML EventLoop to wait for promise to be fulfilled

Which will have proper handling of the exection context when performing
a microtask checkpoint. This fixes an assertion to be added in the next
commit where perform_a_microtask_check is invoked on a non-empty
execution context stack.
This commit is contained in:
Shannon Booth 2025-01-03 12:08:37 +13:00 committed by Andreas Kling
parent 01f8ab35f1
commit 2fb4fcf4a0
Notes: github-actions[bot] 2025-01-03 10:00:31 +00:00

View file

@ -157,7 +157,7 @@ WebIDL::ExceptionOr<void> FileReader::read_operation(Blob& blob, Type type, Opti
// 1. Wait for chunkPromise to be fulfilled or rejected.
// FIXME: Create spec issue to use WebIDL react to promise steps here instead of this custom logic
Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [promise]() {
HTML::main_thread_event_loop().spin_until(GC::create_function(heap(), [promise]() {
return promise->state() == JS::Promise::State::Fulfilled || promise->state() == JS::Promise::State::Rejected;
}));