LibJS+LibWeb: Mark a few variables as IGNORE_USE_IN_ESCAPING_LAMBDA

This is a bit noisy, but it'll be better once we upgrade to C++23.
This commit is contained in:
Matthew Olsson 2024-04-07 16:32:33 -07:00 committed by Andreas Kling
parent ff00d21d58
commit d47f656a3a
4 changed files with 14 additions and 13 deletions

View file

@ -39,8 +39,9 @@ ThrowCompletionOr<Value> await(VM& vm, Value value)
// 2. Let promise be ? PromiseResolve(%Promise%, value).
auto* promise_object = TRY(promise_resolve(vm, realm.intrinsics().promise_constructor(), value));
Optional<bool> success;
Value result;
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<bool> success;
IGNORE_USE_IN_ESCAPING_LAMBDA Value result;
// 3. Let fulfilledClosure be a new Abstract Closure with parameters (value) that captures asyncContext and performs the following steps when called:
auto fulfilled_closure = [&success, &result](VM& vm) -> ThrowCompletionOr<Value> {
// a. Let prevContext be the running execution context.

View file

@ -3048,7 +3048,7 @@ void Document::destroy_a_document_and_its_descendants(JS::SafeFunction<void()> a
auto child_navigables = document_tree_child_navigables();
// 3. Let numberDestroyed be 0.
size_t number_destroyed = 0;
IGNORE_USE_IN_ESCAPING_LAMBDA size_t number_destroyed = 0;
// 3. For each childNavigable of childNavigable's, queue a global task on the navigation and traversal task source
// given childNavigable's active window to perform the following steps:
@ -3249,7 +3249,7 @@ void Document::unload_a_document_and_its_descendants(JS::GCPtr<Document> new_doc
auto child_navigables = document_tree_child_navigables();
// 2. Let numberUnloaded be 0.
size_t number_unloaded = 0;
IGNORE_USE_IN_ESCAPING_LAMBDA size_t number_unloaded = 0;
// Spec FIXME: in what order?
// 3. For each childNavigable of childNavigable's, queue a global task on the navigation and traversal task source

View file

@ -821,7 +821,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
// -> If mode is attribute
case SelectMode::Attribute: {
auto failed_with_attribute = [this](auto error_message) {
bool ran_media_element_task = false;
IGNORE_USE_IN_ESCAPING_LAMBDA bool ran_media_element_task = false;
// 6. Failed with attribute: Reaching this step indicates that the media resource failed to load or that the given URL could not be parsed. Take
// pending play promises and queue a media element task given the media element to run the dedicated media source failure steps with the result.

View file

@ -381,11 +381,11 @@ static void deactivate_a_document_for_cross_document_navigation(JS::NonnullGCPtr
TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_step(
int step,
bool check_for_cancelation,
Optional<SourceSnapshotParams> source_snapshot_params,
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<SourceSnapshotParams> source_snapshot_params,
JS::GCPtr<Navigable> initiator_to_check,
Optional<UserNavigationInvolvement> user_involvement_for_navigate_events,
Optional<Bindings::NavigationType> navigation_type,
SynchronousNavigation synchronous_navigation)
IGNORE_USE_IN_ESCAPING_LAMBDA Optional<Bindings::NavigationType> navigation_type,
IGNORE_USE_IN_ESCAPING_LAMBDA SynchronousNavigation synchronous_navigation)
{
auto& vm = this->vm();
// FIXME: 1. Assert: This is running within traversable's session history traversal queue.
@ -438,7 +438,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
auto total_change_jobs = changing_navigables.size();
// 10. Let completedChangeJobs be 0.
size_t completed_change_jobs = 0;
IGNORE_USE_IN_ESCAPING_LAMBDA size_t completed_change_jobs = 0;
struct ChangingNavigableContinuationState {
JS::Handle<DOM::Document> displayed_document;
@ -449,7 +449,7 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
// 11. Let changingNavigableContinuations be an empty queue of changing navigable continuation states.
// NOTE: This queue is used to split the operations on changingNavigables into two parts. Specifically, changingNavigableContinuations holds data for the second part.
Queue<ChangingNavigableContinuationState> changing_navigable_continuations;
IGNORE_USE_IN_ESCAPING_LAMBDA Queue<ChangingNavigableContinuationState> changing_navigable_continuations;
// 12. For each navigable of changingNavigables, queue a global task on the navigation and traversal task source of navigable's active window to run the steps:
for (auto& navigable : changing_navigables) {
@ -705,12 +705,12 @@ TraversableNavigable::HistoryStepResult TraversableNavigable::apply_the_history_
auto total_non_changing_jobs = non_changing_navigables_that_still_need_updates.size();
// 16. Let completedNonchangingJobs be 0.
auto completed_non_changing_jobs = 0u;
IGNORE_USE_IN_ESCAPING_LAMBDA auto completed_non_changing_jobs = 0u;
// 17. Let (scriptHistoryLength, scriptHistoryIndex) be the result of getting the history object length and index given traversable and targetStep.
auto length_and_index = get_the_history_object_length_and_index(target_step);
auto script_history_length = length_and_index.script_history_length;
auto script_history_index = length_and_index.script_history_index;
IGNORE_USE_IN_ESCAPING_LAMBDA auto script_history_length = length_and_index.script_history_length;
IGNORE_USE_IN_ESCAPING_LAMBDA auto script_history_index = length_and_index.script_history_index;
// 18. For each navigable of nonchangingNavigablesThatStillNeedUpdates, queue a global task on the navigation and traversal task source given navigable's active window to run the steps:
for (auto& navigable : non_changing_navigables_that_still_need_updates) {