mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02: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:
committed by
Tim Flynn
parent
786e93b6c7
commit
52ee05cb5d
Notes:
github-actions[bot]
2026-02-21 16:15:52 +00:00
Author: https://github.com/Praise-Garfield Commit: https://github.com/LadybirdBrowser/ladybird/commit/52ee05cb5d9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8064 Reviewed-by: https://github.com/trflynn89 ✅
@@ -7,7 +7,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Script.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/Scripting/ImportMap.h>
|
||||
@@ -16,9 +15,7 @@
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#import-map-parse-result
|
||||
class ImportMapParseResult
|
||||
: public JS::Cell
|
||||
, public JS::Script::HostDefined {
|
||||
class ImportMapParseResult : public JS::Cell {
|
||||
GC_CELL(ImportMapParseResult, JS::Cell);
|
||||
GC_DECLARE_ALLOCATOR(ImportMapParseResult);
|
||||
|
||||
@@ -41,8 +38,6 @@ protected:
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
virtual void visit_host_defined_self(Visitor&) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#impr-import-map
|
||||
Optional<ImportMap> m_import_map;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user