From 2fb4fcf4a09d936bf0a0b6b4b2ada9aaf0ef5177 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Fri, 3 Jan 2025 12:08:37 +1300 Subject: [PATCH] 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. --- Libraries/LibWeb/FileAPI/FileReader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/FileAPI/FileReader.cpp b/Libraries/LibWeb/FileAPI/FileReader.cpp index 77656e8ee27..376f29df4dd 100644 --- a/Libraries/LibWeb/FileAPI/FileReader.cpp +++ b/Libraries/LibWeb/FileAPI/FileReader.cpp @@ -157,7 +157,7 @@ WebIDL::ExceptionOr 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; }));