1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibWeb: Use Core::Timer for style and layout update timers in Document

Fixes leaking of DOM::Document by capturing it into JS::SafeFunction
callback when using Platform::Timer for style and layout update timers.
This commit is contained in:
Aliaksandr Kalenik 2023-07-20 12:59:03 +02:00 committed by Andreas Kling
parent 8ec691057f
commit 608a730bd6
2 changed files with 7 additions and 7 deletions

View file

@ -11,6 +11,7 @@
#include <AK/Debug.h>
#include <AK/StringBuilder.h>
#include <AK/Utf8View.h>
#include <LibCore/Timer.h>
#include <LibJS/Interpreter.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/FunctionObject.h>
@ -84,7 +85,6 @@
#include <LibWeb/Namespace.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
#include <LibWeb/Platform/Timer.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGTitleElement.h>
#include <LibWeb/SVG/TagNames.h>
@ -319,13 +319,13 @@ Document::Document(JS::Realm& realm, const AK::URL& url)
{
HTML::main_thread_event_loop().register_document({}, *this);
m_style_update_timer = Platform::Timer::create_single_shot(0, [this] {
m_style_update_timer = Core::Timer::create_single_shot(0, [this] {
update_style();
});
}).release_value_but_fixme_should_propagate_errors();
m_layout_update_timer = Platform::Timer::create_single_shot(0, [this] {
m_layout_update_timer = Core::Timer::create_single_shot(0, [this] {
update_layout();
});
}).release_value_but_fixme_should_propagate_errors();
}
Document::~Document()