1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:27:45 +00:00

LibWeb: Make queue_an_element_task() use JS::SafeFunction

This commit is contained in:
Andreas Kling 2022-09-24 12:14:53 +02:00
parent 2ccb9bef49
commit 874e64d664
2 changed files with 3 additions and 5 deletions

View file

@ -552,11 +552,9 @@ void Element::make_html_uppercased_qualified_name()
} }
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task // https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task
void Element::queue_an_element_task(HTML::Task::Source source, Function<void()> steps) void Element::queue_an_element_task(HTML::Task::Source source, JS::SafeFunction<void()> steps)
{ {
auto task = HTML::Task::create(source, &document(), [strong_this = JS::make_handle(*this), steps = move(steps)] { auto task = HTML::Task::create(source, &document(), move(steps));
steps();
});
HTML::main_thread_event_loop().task_queue().add(move(task)); HTML::main_thread_event_loop().task_queue().add(move(task));
} }

View file

@ -122,7 +122,7 @@ public:
void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); } void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); }
HashMap<FlyString, CSS::StyleProperty> const& custom_properties() const { return m_custom_properties; } HashMap<FlyString, CSS::StyleProperty> const& custom_properties() const { return m_custom_properties; }
void queue_an_element_task(HTML::Task::Source, Function<void()>); void queue_an_element_task(HTML::Task::Source, JS::SafeFunction<void()>);
bool is_void_element() const; bool is_void_element() const;
bool serializes_as_void() const; bool serializes_as_void() const;