mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Fix document leak in SVGDecodedImageData
The SVGDecodedImageData creates a new Page and replaces its document with a new one that contains SVG content. This change adds a destroy call on the replaced document. Without this addition, all tasks scheduled on the event loop during navigation, initiated while the page's traversable is being created, will never execute, as the initial replaced document will become inactive. This leads to a document leak because the tasks use JS::Handle to hold document pointer. Making the destroy call resolves the issue because it removes all tasks associated with the destroyed document from the queue.
This commit is contained in:
parent
12c6692611
commit
a41f23a0fc
Notes:
sideshowbarker
2024-07-17 10:31:19 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/a41f23a0fc Pull-request: https://github.com/SerenityOS/serenity/pull/21224
1 changed files with 2 additions and 0 deletions
|
@ -67,8 +67,10 @@ ErrorOr<NonnullRefPtr<SVGDecodedImageData>> SVGDecodedImageData::create(Page& ho
|
|||
.cross_origin_opener_policy = HTML::CrossOriginOpenerPolicy {},
|
||||
.about_base_url = {},
|
||||
};
|
||||
// FIXME: Use Navigable::navigate() instead of manually replacing the navigable's document.
|
||||
auto document = DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html", navigation_params).release_value_but_fixme_should_propagate_errors();
|
||||
navigable->set_ongoing_navigation({});
|
||||
navigable->active_document()->destroy();
|
||||
navigable->active_session_history_entry()->document_state->set_document(document);
|
||||
|
||||
auto parser = HTML::HTMLParser::create_with_uncertain_encoding(document, data);
|
||||
|
|
Loading…
Reference in a new issue