mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-23 19:42:53 +00:00
LibWeb: Move SVGElement's dataset construction to initialize()
It's not safe to allocate new cells while in a cell constructor.
This commit is contained in:
parent
055dabc123
commit
0f4b82bdea
Notes:
sideshowbarker
2024-07-17 08:43:11 +09:00
Author: https://github.com/awesomekling
Commit: 0f4b82bdea
Pull-request: https://github.com/SerenityOS/serenity/pull/18957
2 changed files with 7 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/ExceptionOrUtils.h>
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/HTML/DOMStringMap.h>
|
#include <LibWeb/HTML/DOMStringMap.h>
|
||||||
#include <LibWeb/SVG/SVGElement.h>
|
#include <LibWeb/SVG/SVGElement.h>
|
||||||
|
@ -12,7 +13,6 @@ namespace Web::SVG {
|
||||||
|
|
||||||
SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||||
: Element(document, move(qualified_name))
|
: Element(document, move(qualified_name))
|
||||||
, m_dataset(HTML::DOMStringMap::create(*this).release_value_but_fixme_should_propagate_errors())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,13 +21,17 @@ JS::ThrowCompletionOr<void> SVGElement::initialize(JS::Realm& realm)
|
||||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement"));
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement"));
|
||||||
|
|
||||||
|
m_dataset = TRY(Bindings::throw_dom_exception_if_needed(realm.vm(), [&]() {
|
||||||
|
return HTML::DOMStringMap::create(*this);
|
||||||
|
}));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
visitor.visit(m_dataset.ptr());
|
visitor.visit(m_dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ protected:
|
||||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
JS::NonnullGCPtr<HTML::DOMStringMap> m_dataset;
|
JS::GCPtr<HTML::DOMStringMap> m_dataset;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue