mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 08:48:49 +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
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/URL.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibWeb/HTML/Scripting/ModuleScript.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -33,8 +34,8 @@ private:
|
|||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map
|
||||
class ModuleMap {
|
||||
AK_MAKE_NONCOPYABLE(ModuleMap);
|
||||
class ModuleMap final : public JS::Cell {
|
||||
JS_CELL(ModuleMap, Cell);
|
||||
|
||||
public:
|
||||
ModuleMap() = default;
|
||||
|
@ -63,6 +64,8 @@ public:
|
|||
void wait_for_change(AK::URL const& url, DeprecatedString const& type, Function<void(Entry)> callback);
|
||||
|
||||
private:
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
HashMap<ModuleLocationTuple, Entry> m_values;
|
||||
HashMap<ModuleLocationTuple, Vector<Function<void(Entry)>>> m_callbacks;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue