1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

LibWeb: Visit custom element's lifecycle callbacks

...instead of using JS::Handle which causes leaks when object holding
the callback can be reached by visiting the callback's dependencies.
This commit is contained in:
Aliaksandr Kalenik 2024-03-11 19:12:52 +01:00 committed by Alexander Kalenik
parent 3d48c55e50
commit 3b4230e0b0
5 changed files with 26 additions and 5 deletions

View file

@ -20,7 +20,7 @@ class CustomElementDefinition : public JS::Cell {
JS_CELL(CustomElementDefinition, JS::Cell);
JS_DECLARE_ALLOCATOR(CustomElementDefinition);
using LifecycleCallbacksStorage = OrderedHashMap<FlyString, JS::Handle<WebIDL::CallbackType>>;
using LifecycleCallbacksStorage = OrderedHashMap<FlyString, JS::GCPtr<WebIDL::CallbackType>>;
using ConstructionStackStorage = Vector<Variant<JS::Handle<DOM::Element>, AlreadyConstructedCustomElementMarker>>;
static JS::NonnullGCPtr<CustomElementDefinition> create(JS::Realm& realm, String const& name, String const& local_name, WebIDL::CallbackType& constructor, Vector<String>&& observed_attributes, LifecycleCallbacksStorage&& lifecycle_callbacks, bool form_associated, bool disable_internals, bool disable_shadow)
@ -60,6 +60,8 @@ private:
{
}
virtual void visit_edges(Visitor& visitor) override;
// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-name
// A name
// A valid custom element name