mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
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:
parent
31d21570bf
commit
6ed2bf2bb1
Notes:
github-actions[bot]
2024-12-10 06:14:10 +00:00
Author: https://github.com/ADKaster
Commit: 6ed2bf2bb1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2860
6 changed files with 17 additions and 16 deletions
|
@ -280,7 +280,7 @@ void EventSource::announce_the_connection()
|
|||
// https://html.spec.whatwg.org/multipage/server-sent-events.html#reestablish-the-connection
|
||||
void EventSource::reestablish_the_connection()
|
||||
{
|
||||
bool initial_task_has_run { false };
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA bool initial_task_has_run { false };
|
||||
|
||||
// 1. Queue a task to run the following steps:
|
||||
HTML::queue_a_task(HTML::Task::Source::RemoteEvent, nullptr, nullptr, GC::create_function(heap(), [&]() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -429,7 +429,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
bool check_for_cancelation,
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<SourceSnapshotParams> source_snapshot_params,
|
||||
GC::Ptr<Navigable> initiator_to_check,
|
||||
Optional<UserNavigationInvolvement> user_involvement_for_navigate_events,
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<UserNavigationInvolvement> user_involvement_for_navigate_events,
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<Bindings::NavigationType> navigation_type,
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA SynchronousNavigation synchronous_navigation)
|
||||
{
|
||||
|
@ -487,7 +487,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
}
|
||||
|
||||
// 9. Let totalChangeJobs be the size of changingNavigables.
|
||||
auto total_change_jobs = changing_navigables.size();
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto total_change_jobs = changing_navigables.size();
|
||||
|
||||
// 10. Let completedChangeJobs be 0.
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA size_t completed_change_jobs = 0;
|
||||
|
@ -799,7 +799,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
|
|||
}));
|
||||
|
||||
// 15. Let totalNonchangingJobs be the size of nonchangingNavigablesThatStillNeedUpdates.
|
||||
auto total_non_changing_jobs = non_changing_navigables_that_still_need_updates.size();
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto total_non_changing_jobs = non_changing_navigables_that_still_need_updates.size();
|
||||
|
||||
// 16. Let completedNonchangingJobs be 0.
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto completed_non_changing_jobs = 0u;
|
||||
|
@ -880,10 +880,10 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che
|
|||
documents_to_fire_beforeunload.append(navigable->active_document());
|
||||
|
||||
// 2. Let unloadPromptShown be false.
|
||||
auto unload_prompt_shown = false;
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto unload_prompt_shown = false;
|
||||
|
||||
// 3. Let finalStatus be "continue".
|
||||
auto final_status = CheckIfUnloadingIsCanceledResult::Continue;
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto final_status = CheckIfUnloadingIsCanceledResult::Continue;
|
||||
|
||||
// 4. If traversable was given, then:
|
||||
if (traversable) {
|
||||
|
@ -900,7 +900,7 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che
|
|||
VERIFY(user_involvement_for_navigate_events.has_value());
|
||||
|
||||
// 2. Let eventsFired be false.
|
||||
auto events_fired = false;
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto events_fired = false;
|
||||
|
||||
// 3. Let needsBeforeunload be true if navigablesThatNeedBeforeUnload contains traversable; otherwise false.
|
||||
auto it = navigables_that_need_before_unload.find_if([&traversable](GC::Root<Navigable> navigable) {
|
||||
|
@ -964,10 +964,10 @@ TraversableNavigable::CheckIfUnloadingIsCanceledResult TraversableNavigable::che
|
|||
}
|
||||
|
||||
// 5. Let totalTasks be the size of documentsThatNeedBeforeunload.
|
||||
auto total_tasks = documents_to_fire_beforeunload.size();
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA auto total_tasks = documents_to_fire_beforeunload.size();
|
||||
|
||||
// 6. Let completedTasks be 0.
|
||||
size_t completed_tasks = 0;
|
||||
IGNORE_USE_IN_ESCAPING_LAMBDA size_t completed_tasks = 0;
|
||||
|
||||
// 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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue