mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibWeb: Use JS::SafeFunction in the HTML task queues
This means that HTML tasks automatically protect anything in their capture lists, and we no longer need to jump through hoops with JS::Handle etc.
This commit is contained in:
parent
131c3f50de
commit
d505192014
4 changed files with 13 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@
|
|||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/SafeFunction.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -30,7 +31,7 @@ public:
|
|||
JavaScriptEngine,
|
||||
};
|
||||
|
||||
static NonnullOwnPtr<Task> create(Source source, DOM::Document* document, Function<void()> steps)
|
||||
static NonnullOwnPtr<Task> create(Source source, DOM::Document* document, JS::SafeFunction<void()> steps)
|
||||
{
|
||||
return adopt_own(*new Task(source, document, move(steps)));
|
||||
}
|
||||
|
@ -45,10 +46,10 @@ public:
|
|||
bool is_runnable() const;
|
||||
|
||||
private:
|
||||
Task(Source, DOM::Document*, Function<void()> steps);
|
||||
Task(Source, DOM::Document*, JS::SafeFunction<void()> steps);
|
||||
|
||||
Source m_source { Source::Unspecified };
|
||||
Function<void()> m_steps;
|
||||
JS::SafeFunction<void()> m_steps;
|
||||
JS::Handle<DOM::Document> m_document;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue