mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
LibWeb: Make module maps GC-allocated
This allows them to mark JS modules, and fixes a crash seen on https://shopify.com/
This commit is contained in:
parent
853ecb8d8e
commit
3811be2f7c
Notes:
sideshowbarker
2024-07-17 18:23:22 +09:00
Author: https://github.com/awesomekling
Commit: 3811be2f7c
Pull-request: https://github.com/SerenityOS/serenity/pull/18634
4 changed files with 24 additions and 4 deletions
|
@ -33,10 +33,18 @@ EnvironmentSettingsObject::~EnvironmentSettingsObject()
|
|||
responsible_event_loop().unregister_environment_settings_object({}, *this);
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> EnvironmentSettingsObject::initialize(JS::Realm& realm)
|
||||
{
|
||||
MUST_OR_THROW_OOM(Base::initialize(realm));
|
||||
m_module_map = realm.heap().allocate_without_realm<ModuleMap>();
|
||||
return {};
|
||||
}
|
||||
|
||||
void EnvironmentSettingsObject::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(target_browsing_context);
|
||||
visitor.visit(m_module_map);
|
||||
visitor.ignore(m_outstanding_rejected_promises_weak_set);
|
||||
}
|
||||
|
||||
|
@ -48,7 +56,7 @@ JS::ExecutionContext& EnvironmentSettingsObject::realm_execution_context()
|
|||
|
||||
ModuleMap& EnvironmentSettingsObject::module_map()
|
||||
{
|
||||
return m_module_map;
|
||||
return *m_module_map;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object%27s-realm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue