mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Fix GC leaks in Fetch::Infrastructure::Body::fully_read()
By making this function accept the success and error steps as HeapFunction rather than SafeFunction, we break a bunch of strong GC cycles.
This commit is contained in:
parent
0c84508f87
commit
184368285c
Notes:
sideshowbarker
2024-07-17 05:09:48 +09:00
Author: https://github.com/awesomekling
Commit: 184368285c
Pull-request: https://github.com/SerenityOS/serenity/pull/24078
9 changed files with 67 additions and 67 deletions
|
@ -518,15 +518,15 @@ WebIDL::ExceptionOr<void> HTMLLinkElement::load_fallback_favicon_if_needed(JS::N
|
|||
auto& realm = document->realm();
|
||||
auto global = JS::NonnullGCPtr { realm.global_object() };
|
||||
|
||||
auto process_body = [document, request](auto body) {
|
||||
auto process_body = JS::create_heap_function(realm.heap(), [document, request](ByteBuffer body) {
|
||||
decode_favicon(body, request->url(), document->navigable());
|
||||
};
|
||||
auto process_body_error = [](auto) {
|
||||
};
|
||||
});
|
||||
auto process_body_error = JS::create_heap_function(realm.heap(), [](JS::GCPtr<WebIDL::DOMException>) {
|
||||
});
|
||||
|
||||
// 3. Use response's unsafe response as an icon as if it had been declared using the icon keyword.
|
||||
if (auto body = response->unsafe_response()->body())
|
||||
body->fully_read(realm, move(process_body), move(process_body_error), global).release_value_but_fixme_should_propagate_errors();
|
||||
body->fully_read(realm, process_body, process_body_error, global).release_value_but_fixme_should_propagate_errors();
|
||||
};
|
||||
|
||||
TRY(Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue