LibWeb: Mark local variables captured in GC functions as ignored

These variables are all captured in queued events or other event loop
tasks, but are all guarded by event loop spins later in the function.

The IGNORE_USE_IN_ESCAPING_LAMBDA will soon be required for all locals
that are captured by ref in GC::Function as well as AK::Function.
This commit is contained in:
Andrew Kaster 2024-12-09 19:47:09 -07:00 committed by Andreas Kling
parent 31d21570bf
commit 6ed2bf2bb1
Notes: github-actions[bot] 2024-12-10 06:14:10 +00:00
6 changed files with 17 additions and 16 deletions

View file

@ -475,7 +475,7 @@ WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_scri
auto& vm = realm.vm();
// 1. Let response be null.
GC::Ptr<Fetch::Infrastructure::Response> response = nullptr;
IGNORE_USE_IN_ESCAPING_LAMBDA GC::Ptr<Fetch::Infrastructure::Response> response = nullptr;
// 2. Let bodyBytes be null.
Fetch::Infrastructure::FetchAlgorithms::BodyBytes body_bytes;
@ -510,6 +510,7 @@ WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_scri
}
// 5. Pause until response is not null.
// FIXME: Consider using a "response holder" to avoid needing to annotate response as IGNORE_USE_IN_ESCAPING_LAMBDA.
auto& event_loop = settings_object.responsible_event_loop();
event_loop.spin_until(GC::create_function(vm.heap(), [&]() -> bool {
return response;