mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibWeb: Ignore HTML tasks enqueued in document used for fragment parsing
The inert temporary documents used for fragment parsing will never become "fully active" and so any tasks associated with them will never run. To avoid memory leaks, we now simply ignore any attempts to enqueue tasks associated with such documents.
This commit is contained in:
committed by
Andreas Kling
parent
f12f72f139
commit
7bc07662be
Notes:
github-actions[bot]
2025-12-27 15:42:23 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/7bc07662be1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7244 Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/shannonbooth
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGC/RootVector.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/EventLoop/TaskQueue.h>
|
||||
|
||||
@@ -28,6 +29,11 @@ void TaskQueue::visit_edges(Visitor& visitor)
|
||||
|
||||
void TaskQueue::add(GC::Ref<Task> task)
|
||||
{
|
||||
// AD-HOC: Don't enqueue tasks for temporary (inert) documents used for fragment parsing.
|
||||
// FIXME: There's ongoing spec work to remove such documents: https://github.com/whatwg/html/pull/11970
|
||||
if (task->document() && task->document()->is_temporary_document_for_fragment_parsing())
|
||||
return;
|
||||
|
||||
m_tasks.append(task);
|
||||
m_event_loop->schedule();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user