mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
LibWeb: Visit ImportMapParseResult in HTMLScriptElement::visit_edges
The m_result Variant can hold a GC::Ref<ImportMapParseResult> when the script element has type="importmap", but visit_edges only traced the GC::Ref<Script> arm. This left the ImportMapParseResult unvisited, allowing the GC to collect it while the element still held a reference. ImportMapParseResult inherited from JS::Script::HostDefined, but no JS::Script or JS::Module ever stored it as host_defined data, so visit_host_defined_self was dead code. This removes the HostDefined inheritance entirely and switches m_result visitation to Variant::visit with a lambda that catches all GC::Ref arms.
This commit is contained in:
parent
786e93b6c7
commit
52ee05cb5d
Notes:
github-actions[bot]
2026-02-21 16:15:52 +00:00
Author: https://github.com/Praise-Garfield
Commit: 52ee05cb5d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8064
Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 5 additions and 13 deletions
|
|
@ -48,8 +48,10 @@ void HTMLScriptElement::initialize(JS::Realm& realm)
|
|||
void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
if (auto* script = m_result.get_pointer<GC::Ref<Script>>())
|
||||
visitor.visit(*script);
|
||||
m_result.visit(
|
||||
[](ResultState::Uninitialized) {},
|
||||
[](ResultState::Null) {},
|
||||
[&]<typename T>(GC::Ref<T> result) { visitor.visit(result); });
|
||||
visitor.visit(m_parser_document);
|
||||
visitor.visit(m_preparation_time_document);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue