mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-30 00:09:01 +00:00
LibWeb: Register Wasm memory grow hook in constructor of Memory objects
Previously it would only register the hook for JavaScript constructed Memory objects. This allows Ruffle to load again.
This commit is contained in:
parent
f2eaf3381f
commit
d2acf32aae
Notes:
github-actions[bot]
2024-12-10 14:55:18 +00:00
Author: https://github.com/Lubrsi
Commit: d2acf32aae
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2865
3 changed files with 30 additions and 4 deletions
|
@ -39,10 +39,6 @@ WebIDL::ExceptionOr<GC::Ref<Memory>> Memory::construct_impl(JS::Realm& realm, Me
|
|||
|
||||
auto memory_object = realm.create<Memory>(realm, *address, shared ? Shared::Yes : Shared::No);
|
||||
|
||||
cache.abstract_machine().store().get(*address)->successful_grow_hook = [memory_object] {
|
||||
MUST(memory_object->reset_the_memory_buffer());
|
||||
};
|
||||
|
||||
return memory_object;
|
||||
}
|
||||
|
||||
|
@ -51,6 +47,11 @@ Memory::Memory(JS::Realm& realm, Wasm::MemoryAddress address, Shared shared)
|
|||
, m_address(address)
|
||||
, m_shared(shared)
|
||||
{
|
||||
auto& cache = Detail::get_cache(realm);
|
||||
|
||||
cache.abstract_machine().store().get(address)->successful_grow_hook = [this] {
|
||||
MUST(reset_the_memory_buffer());
|
||||
};
|
||||
}
|
||||
|
||||
void Memory::initialize(JS::Realm& realm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue