LibWeb: Use HeapFunction for EventLoopPlugin::spin_until

This commit is contained in:
Shannon Booth 2024-10-31 01:06:56 +13:00 committed by Alexander Kalenik
parent de1a805898
commit 7487a782db
Notes: github-actions[bot] 2024-10-30 19:57:14 +00:00
15 changed files with 29 additions and 26 deletions

View file

@ -157,9 +157,9 @@ 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([&]() {
Platform::EventLoopPlugin::the().spin_until(JS::create_heap_function(heap(), [promise]() {
return promise->state() == JS::Promise::State::Fulfilled || promise->state() == JS::Promise::State::Rejected;
});
}));
// 2. If chunkPromise is fulfilled, and isFirstChunk is true, queue a task to fire a progress event called loadstart at fr.
// NOTE: ISSUE 2 We might change loadstart to be dispatched synchronously, to align with XMLHttpRequest behavior. [Issue #119]