diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp index c24da1e4a75..cd6acf934cb 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -352,8 +352,8 @@ WebIDL::ExceptionOr> HTMLImageElement::decode() const // 3. Otherwise, in parallel wait for one of the following cases to occur, and perform the corresponding actions: Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(heap(), [this, promise, &realm, &global] { - Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [&] { - auto queue_reject_task = [&](String const& message) { + Platform::EventLoopPlugin::the().spin_until(GC::create_function(heap(), [this, promise, &realm, &global] { + auto queue_reject_task = [promise, &realm, &global](String const& message) { queue_global_task(Task::Source::DOMManipulation, global, GC::create_function(realm.heap(), [&realm, promise, message = String(message)] { auto exception = WebIDL::EncodingError::create(realm, message); HTML::TemporaryExecutionContext context(realm); diff --git a/Libraries/LibWeb/HTML/Navigable.cpp b/Libraries/LibWeb/HTML/Navigable.cpp index 1af55cd4ba1..404ff4ce491 100644 --- a/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Libraries/LibWeb/HTML/Navigable.cpp @@ -890,7 +890,7 @@ static WebIDL::ExceptionOr create_navigation } // 7. Wait until either response is non-null, or navigable's ongoing navigation changes to no longer equal navigationId. - HTML::main_thread_event_loop().spin_until(GC::create_function(vm.heap(), [&]() { + HTML::main_thread_event_loop().spin_until(GC::create_function(vm.heap(), [navigation_id, navigable, response_holder]() { if (response_holder->response() != nullptr) return true; diff --git a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 84b4cdbd35f..b5610ea94a6 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -298,7 +298,7 @@ void HTMLParser::the_end(GC::Ref document, GC::Ptr pa while (!document->scripts_to_execute_when_parsing_has_finished().is_empty()) { // 1. Spin the event loop until the first script in the list of scripts that will execute when the document has finished parsing // has its "ready to be parser-executed" flag set and the parser's Document has no style sheet that is blocking scripts. - main_thread_event_loop().spin_until(GC::create_function(heap, [&] { + main_thread_event_loop().spin_until(GC::create_function(heap, [document] { return document->scripts_to_execute_when_parsing_has_finished().first()->is_ready_to_be_parser_executed() && !document->has_a_style_sheet_that_is_blocking_scripts(); })); @@ -311,7 +311,7 @@ void HTMLParser::the_end(GC::Ref document, GC::Ptr pa } // 6. Queue a global task on the DOM manipulation task source given the Document's relevant global object to run the following substeps: - queue_global_task(HTML::Task::Source::DOMManipulation, *document, GC::create_function(heap, [document = document] { + queue_global_task(HTML::Task::Source::DOMManipulation, *document, GC::create_function(heap, [document] { // 1. Set the Document's load timing info's DOM content loaded event start time to the current high resolution time given the Document's relevant global object. document->load_timing_info().dom_content_loaded_event_start_time = HighResolutionTime::current_high_resolution_time(relevant_global_object(*document)); @@ -329,17 +329,17 @@ void HTMLParser::the_end(GC::Ref document, GC::Ptr pa })); // 7. Spin the event loop until the set of scripts that will execute as soon as possible and the list of scripts that will execute in order as soon as possible are empty. - main_thread_event_loop().spin_until(GC::create_function(heap, [&] { + main_thread_event_loop().spin_until(GC::create_function(heap, [document] { return document->scripts_to_execute_as_soon_as_possible().is_empty(); })); // 8. Spin the event loop until there is nothing that delays the load event in the Document. - main_thread_event_loop().spin_until(GC::create_function(heap, [&] { + main_thread_event_loop().spin_until(GC::create_function(heap, [document] { return !document->anything_is_delaying_the_load_event(); })); // 9. Queue a global task on the DOM manipulation task source given the Document's relevant global object to run the following steps: - queue_global_task(HTML::Task::Source::DOMManipulation, *document, GC::create_function(document->heap(), [document = document] { + queue_global_task(HTML::Task::Source::DOMManipulation, *document, GC::create_function(document->heap(), [document] { // 1. Update the current document readiness to "complete". document->update_readiness(HTML::DocumentReadyState::Complete); diff --git a/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Libraries/LibWeb/HTML/TraversableNavigable.cpp index 132594d789c..a9db18b6e63 100644 --- a/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -917,7 +917,7 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che // 5. Queue a global task on the navigation and traversal task source given traversable's active window to perform the following steps: VERIFY(traversable->active_window()); - queue_global_task(Task::Source::NavigationAndTraversal, *traversable->active_window(), GC::create_function(heap(), [&] { + queue_global_task(Task::Source::NavigationAndTraversal, *traversable->active_window(), GC::create_function(heap(), [needs_beforeunload, user_involvement_for_navigate_events, traversable, target_entry, &final_status, &unload_prompt_shown, &events_fired] { // 1. if needsBeforeunload is true, then: if (needs_beforeunload) { // 1. Let (unloadPromptShownForThisDocument, unloadPromptCanceledByThisDocument) be the result of running the steps to fire beforeunload given traversable's active document and false. @@ -971,7 +971,7 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che // 7. For each document of documents, queue a global task on the navigation and traversal task source given document's relevant global object to run the steps: for (auto& document : documents_to_fire_beforeunload) { - queue_global_task(Task::Source::NavigationAndTraversal, relevant_global_object(*document), GC::create_function(heap(), [&] { + queue_global_task(Task::Source::NavigationAndTraversal, relevant_global_object(*document), GC::create_function(heap(), [document, &final_status, &completed_tasks, &unload_prompt_shown] { // 1. Let (unloadPromptShownForThisDocument, unloadPromptCanceledByThisDocument) be the result of running the steps to fire beforeunload given document and unloadPromptShown. auto [unload_prompt_shown_for_this_document, unload_prompt_canceled_by_this_document] = document->steps_to_fire_beforeunload(unload_prompt_shown);