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

@ -324,11 +324,11 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> HTMLImageElement::decode(
// 2.2 Otherwise, in parallel wait for one of the following cases to occur, and perform the corresponding actions:
Platform::EventLoopPlugin::the().deferred_invoke([this, promise, &realm, reject_if_document_not_fully_active, reject_if_current_request_state_broken] {
Platform::EventLoopPlugin::the().spin_until([&] {
Platform::EventLoopPlugin::the().spin_until(JS::create_heap_function(heap(), [&] {
auto state = this->current_request().state();
return !this->document().is_fully_active() || state == ImageRequest::State::Broken || state == ImageRequest::State::CompletelyAvailable;
});
}));
// 2.2.1 This img element's node document stops being fully active
// 2.2.1 Reject promise with an "EncodingError" DOMException.