mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-25 04:22:50 +00:00
LibWeb: Let queue_fetch_task() take a JS::HeapFunction
Changes the signature of queue_fetch_task() from AK:Function to JS::HeapFunction to be more clear to the user of the function that this is what it uses internally.
This commit is contained in:
parent
a3661fd7f2
commit
291d0e5de8
Notes:
sideshowbarker
2024-07-17 09:37:30 +09:00
Author: https://github.com/kennethmyhra
Commit: 291d0e5de8
Pull-request: https://github.com/SerenityOS/serenity/pull/24026
4 changed files with 21 additions and 21 deletions
|
@ -603,7 +603,7 @@ WebIDL::ExceptionOr<void> fetch_response_handover(JS::Realm& realm, Infrastructu
|
|||
});
|
||||
|
||||
// 4. Let processResponseEndOfBodyTask be the following steps:
|
||||
auto process_response_end_of_body_task = [&fetch_params, &response] {
|
||||
auto process_response_end_of_body_task = JS::create_heap_function(vm.heap(), [&fetch_params, &response] {
|
||||
// 1. Set fetchParams’s request’s done flag.
|
||||
fetch_params.request()->set_done(true);
|
||||
|
||||
|
@ -621,7 +621,7 @@ WebIDL::ExceptionOr<void> fetch_response_handover(JS::Realm& realm, Infrastructu
|
|||
if (fetch_params.request()->initiator_type().has_value() && &client->global_object() == task_destination_global_object->ptr())
|
||||
fetch_params.controller()->report_timing(client->global_object());
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// FIXME: Handle 'parallel queue' task destination
|
||||
auto task_destination = fetch_params.task_destination().get<JS::NonnullGCPtr<JS::Object>>();
|
||||
|
@ -636,9 +636,9 @@ WebIDL::ExceptionOr<void> fetch_response_handover(JS::Realm& realm, Infrastructu
|
|||
// 4. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s process response
|
||||
// given response, with fetchParams’s task destination.
|
||||
if (fetch_params.algorithms()->process_response()) {
|
||||
Infrastructure::queue_fetch_task(fetch_params.controller(), task_destination, [&fetch_params, &response]() {
|
||||
Infrastructure::queue_fetch_task(fetch_params.controller(), task_destination, JS::create_heap_function(vm.heap(), [&fetch_params, &response]() {
|
||||
fetch_params.algorithms()->process_response()(response);
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
// 5. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
|
||||
|
@ -674,9 +674,9 @@ WebIDL::ExceptionOr<void> fetch_response_handover(JS::Realm& realm, Infrastructu
|
|||
// 3. If internalResponse's body is null, then queue a fetch task to run processBody given null, with
|
||||
// fetchParams’s task destination.
|
||||
if (!internal_response->body()) {
|
||||
Infrastructure::queue_fetch_task(fetch_params.controller(), task_destination, [process_body = move(process_body)]() {
|
||||
Infrastructure::queue_fetch_task(fetch_params.controller(), task_destination, JS::create_heap_function(vm.heap(), [process_body = move(process_body)]() {
|
||||
process_body({});
|
||||
});
|
||||
}));
|
||||
}
|
||||
// 4. Otherwise, fully read internalResponse body given processBody, processBodyError, and fetchParams’s task
|
||||
// destination.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue